Checkout JS
Simple JS script to start checkout
The Checkout JS functions is similar to the checkout inline; however, it leverage Javascript to initiate checkout. This approach allow for better flexbility when implementing checkout and ensures a seamless payment process for customers.
Try Payment below
Experiment with the payment process by obtaining Test Data and initiating a sample payment.
Sample Card:
Card number: 5531 8866 5214 2950
Expiry Date: 09/32
CVV: 555,
You can get more sample cards in Test Data and play around with the widget
Simple walk-through
Like the example above
- Import checkout into your code with script tag
- Tie the
startPayment
function to anonclick
button
Options | Data Type | Required | Description |
---|---|---|---|
public_key | String | Yes | Public Key for your Paga business account |
amount | Number | Yes | Amount you want customer to pay |
currency | String | No | Default is NGN , specify if otherwise |
payment_reference | String | No | Payment identifier, if not provided, paga will generate |
charge_url | String | No | Location to redirect your customer after payment |
phone_number | String | No | Customer's phone number |
String | No | Customer's email address | |
display_image | String | No | Merchant preferred image on checkout |
callback_url | String | No | To receive callback for payment, indicate callback url |
funding_sources | List | No | Default is all payment method available. If specific payment method is preffered, specify and separate with comma in preferred orderCARD,PAGA,TRANSFER,AGENT,USSD |
After Payment
Three actions will happen immediately after payment is completed
- if
data-charge_url
is specified, customer will be redirected automatically todata-charge_url
provided in the script tag withcharge_reference=JHX-18743567
&status_message=success
&status_code=0
, otherwise, the customer will be redirect to default checkout success page customise for your account
https://neutral.site/payment/confirmation?charge_reference=JHX-7045679&status_message=success&status_code=0
Params | Data Type | Required | Description |
---|---|---|---|
charge_reference | String | Yes | This is payment reference you provided in the script tag, if not provided we generate one for you |
status_message | String | Yes | success - Indicate the payment was successful |
status_code | Number | Yes | 0 - Success Payment |
- We'll send you a webhook if you provide
data-callback_url
{
"statusCode": 0,
"statusMessage": "success",
"paymentReference": "JHX-18743567",
"amount": 1000,
"currency": "NGN",
"timeStamp": "2021-03-08T15:52:13.000Z",
"description": "Payment successful",
"customerEmail": "[email protected]",
"customerPhoneNumber": "+2348063334156"
}
- We'll send you an email if you've enabled notification on your business account
Verify Charge
This service allows the merchant to verify the status and details of an executed process to determine if a transaction was indeed executed on Paga system using the pre-shared transaction payment reference number.
https://checkout.paga.com/checkout/transaction/verify
POST /checkout/transaction/verify HTTP/1.1
Content-Type: application/json
Accept: application/json
Authorization: "Basic QWxhZGRpbjpvcGVuIHNlc2FtZQ=="
{
paymentReference:"JHX-18743567",
publicKey:"40090E2F-7446-4217-9345-7BBAB7043C4C",
amount:1000,
currency:"NGN"
}
{
"status_code": 0,
"status_message": "successful",
"chargeId":"",
"amount": 1000,
"currency": "NGN"
}
Response | Type | Mandatory(M)/Optional(0) | Description |
---|---|---|---|
status_code | String | M | A status code of 0 indicating successful transaction |
status_message | String | M | A human-readable message describing the transaction result (success or fail) |
chargeId | String | M | The unique reference number code provided with the request |
amount | Number | M | amount charged |
currrencu | String | M | NGN by default |
Updated 13 days ago