How to prepare transaction details

STEP 1:

Ensure you include the following in a single object called merchantDetails

  • OrderId
  • CustomerEmail
  • Currency
  • CustomerPhone
  • OrderAmount
  • BusinessEmail
  • CancelledUrl
  • CallBackUrl
  • Description
  • Checksum
  • PhoneNumber

The following code snippet is a sample of how the merchantDetails object should appear like

const merchantDetails = {
                    OrderId: getRandomOrderNumber().toString(),
                    CustomerEmail: 'mydemoone@gmail.com',
                    Currency: 'KES',
                    CustomerPhone: '0714900876',
                    OrderAmount: '10000',
                    BusinessEmail: 'sometech@sometech.com',
                    CancelledUrl: 'https://localhost:8001/Home/Cancelled',
                    CallBackUrl: 'http://localhost:9200',
                    Description: 'your description',
                    Checksum: 'sample checksum',
                    PhoneNumber: '0724567890''
                }

STEP 2:

Generate your access token and include it in an object called merchantCredentials

To get the token pass the following information to the following URL Acess token Link

  • Username
  • Grant-type which should be indicated as password
  • Password

The following is a Postman example request on how to make the request to get the token

Access token on Postman


{"access_token":"Bc72214a-0db0-4ab1-9263-314fbb2a80ed-d3ad9a29-5a23-44c5-8fe0-df6810dff7aa_d661c1d1-35e0-469f-8dbf-08403c7ad146_eee2a318-0621-471a-b377-a6fc4070cafa_d90 557c0-cc7a-4184-bc94-e8c27da28acd1a9406cd-7ead-4ee9-808c-5fc94384073c...",
"token_type": "bearer",
"expires_in": 1569599,
"userName": "trial@sometech.com",
"roles": "[]",
".issued": "Mon, 18 Aug 2021 10:12:54 GMT",
 ".expires": "Mon, 01 Sep 2021 10:12:54 GMT"
}

The following is a sample of how to include your token in the object merchantCredentials

const merchantCredentials = {
         token: "Bc72214a-0db0-4ab1-9263-314fbb2a80ed-d3ad9a29-5a23-44c5-8fe0-df6810dff7aa_d661c1d1-35e0-469f-8dbf-08403c7ad146_eee2a318-0621-471a-b377-a6fc4070cafa_d90 557c0-cc7a-4184-bc94-e8c27da28acd1a9406cd-7ead-4ee9-808c-5fc94384073c...",
}

STEP 3:

Prepare a checksum and include it in the merchantDetails object Your checksum should be SHA256 encryption of

  • CustomerEmail
  • OrderId
  • OrderAmount
  • Currency
  • BusinessEmail
  • CallBackUrl
  • CancelledUrl
  • clientKey

To prepare a checksum with SHA256 encryption pass the above information in this order:

SHA256(CustomerEmail+OrderId+OrderAmount(integer value of this )+Currency+BusinessEmail+CallBackUrl+CancelledUrl+ClientKey)

STEP 4:

Define your theme and store it in an object called themeDetails. This is optional since if you don’t pass it, JamboPay will use the default theme

STEP 5:

Specify the following and store the details in an object called themeDetails

  1. primaryColor (e.g#000000)
  2. textColor (e.g.#FFFFFF)
  3. payButtonColor (e.g. #33333)
  4. payButtonTextColor (e.g. A9A9A9)
  5. cancelButtonTextColor (e.g #EEEEEE)
  6. payBtnLoaderColor (e.g. #D3D3D3)
  7. cancelBtnLoaderColor (e.g. D35400)

The following code snippet shows how you can define your theme details

const themeDetails = {
                    primaryColor: '#925223',
                    textColor: '#47bbe9',
                    payButtonColor: '#4A160B',
                    payButtonTextColor: '#FFF',
                    cancelButtonTextColor: '#345',
                    payBtnLoaderColor: "#3F8EFC",
                    cancelBtnLoaderColor: "#3F8EFC",

                }

STEP 6:

When you have all these ready, you should have merchantDetails, merchantCredentials, and themeDetails

STEP 7:

Finally, call the function jambopayCheckout and ensure you have passed the above details in the mentioned order as in...

jambopayCheckout(merchantDetails, merchantCredentials, themeDetails);

STEP 8:

A popup will appear prompting you the user payment. Once payment is successful, the user will be redirected to the specified success URL, in case the payment is canceled, the user will be redirected to the specified cancel URL

Untitled