Paga Checkout - Old
This is Paga's checkout experience;
- You make a server call using payment request endpoint with Request_money payment method
-
We return a web-payment link. You will redirect your customer to the link to make payment.
-
Paga will then send you a callback with details of the payment.
Get all the needed information
See the complete request parameter here.
Arguments | Data Type | Description | Required |
---|---|---|---|
referenceNumber | String | A unique reference number representing this request. The same reference number will be returned in the response and can be used to query the payment request status | True |
amount | Number | The amount being requested | True |
currency | String | The currency of the operation, only required if being executed in a foreign currency. | True |
Generate a payment link
<!-- npm install paga-collect -->
const PagaCollectClient = require('paga-collect');
const pagaCollectClient = new PagaCollectClient()
.setClientId("<publicId>")
.setPassword("<secretkey>")
.setApiKey("<HMAC>")
.setTest(true)
.build();
let data = {
"referenceNumber": "53yw19011000009112",
"amount": 200,
"callBackUrl": "http://localhost:5000/core/webhook/paga",
"currency": "NGN",
"expiryDateTimeUTC": "2021-05-20T19:35:47",
"isAllowPartialPayments": false,
"isSuppressMessages": false,
"payee": {"bankAccountNumber": "XXXXXXXXXXX",
"bankId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX",
"name": "John Doe",
"accountNumber": "XXXXXXXXXX"},
"payer": {"email": "[email protected]",
"name": "Foo Bar",
"bankId": "XXXXXXX-XXXX-XXXX-XXXX-XXXXXXXXXX",
"phoneNumber": "XXXXXXXXXXX"},
"payerCollectionFeeShare": 1.0,
"recipientCollectionFeeShare": 0.0,
"paymentMethods": ["BANK_TRANSFER", "FUNDING_USSD"]
}
pagaCollectClient.paymentRequest(data).then(resp => {
console.log(JSON.stringify(resp))
});
// Click here for installation https://developer-docs.paga.com/docs/java-library-4
Collect collect = new Collect.Builder()
.setApiKey(hash_key)
.setPrincipal(principal)
.setCredential(credentials)
.setTest(false)
.build();
PaymentRequestRequest.Payer payer = new PaymentRequestRequest.Payer();
payer.setName("John Doe");
payer.setPhoneNumber("07033333333");
payer.setBankId("3E94C4BC-6F9A-442F-8F1A-8214478D5D86");
PaymentRequestRequest.Payee payee = new PaymentRequestRequest.Payee();
payee.setName("Mary Doe");
payee.setAccountNumber("1111111111");
payee.setBankId("3E94C4BC-6F9A-442F-8F1A-8214478D5D86");
payee.setBankAccountNumber("000000000");
payee.setFinancialIdentificationNumber("02222843212");
List<String> paymentMethods = new ArrayList<>();
paymentMethods.add("BANK_TRANSFER");
paymentMethods.add("FUNDING_USSD");
PaymentRequestResponse paymentRequestResponse = collect.paymentRequest(PaymentRequestRequest.builder()
.referenceNumber("6020000011z10aab2")
.amount("200")
.currency("NGN")
.payer(payer)
.payee(payee)
.expiryDateTimeUTC("2021-06-30T00:00:00")
.isSuppressMessages(true)
.isAllowPartialPayments(true)
.payerCollectionFeeShare(0.5)
.payeeCollectionFeeShare(0.5)
.callBackUrl("http://localhost:9091/test-callback")
.paymentMethods(paymentMethods)
.build());
System.out.println(paymentRequestResponse.toString());
// Click here for installation details https://developer-docs.paga.com/v1.2/docs/php-collect-api
// 1- composer require paga/paga-collect
// 2- require_once __DIR__ .'/vendor/autoload.php;
use PagaCollect\PagaCollectClient;
$collectAPI = PagaCollectClient::builder()
->setClientId("<publicId>")
->setAPIKey("<HMAC>")
->setPassword("<secretKey>")
->setTest(true)
->build();
$data = ["referenceNumber" => "908w1111000001129",
"amount" => 200,
"callBackUrl" => "http://localhost:5000/core/webhook/paga",
"currency" => "NGN",
"expiryDateTimeUTC" => "2021-05-20T19:35:47",
"isAllowPartialPayments" => false,
"isSuppressMessages" => false,
"payee" => ["bankAccountNumber"=>"2097582221",
"bankId" => "40090E2F-7446-4217-9345-7BBAB7043C4C",
"name" => "Odun Ransome",
"phoneNumber" => "08034882885",
"accountNumber" => "2856196652"],
"payer" => ["email" => "[email protected]",
"name"=> "Zubair Abubakar",
"bankId"=> "40090E2F-7446-4217-9345-7BBAB7043C4C",
],
"payerCollectionFeeShare"=> 1.0,
"recipientCollectionFeeShare"=> 0.0,
"paymentMethods"=> ["BANK_TRANSFER", "FUNDING_USSD"]
];
$paymentRequest = $collectAPI->paymentRequest($data);
echo $paymentRequest;
POST /paymentRequest HTTP/1.1
Host: collect.paga.com
hash:1f42eb2a076147063285d6321a969376472c2b2710220051c1736386ff01ea0f9c4ff8ddf43cd8e497327760a2faad9139a4a3af38a1e2c2f68b56851a5a99f1
Authorization: Basic e3t1c2VybmFtZX10Ont7cGnzc3dvcmR9fB==
Content-Type: application/json
Content-Length: 567
{
"referenceNumber": "2460039579797",
"amount": 50,
"currency": "NGN",
"payer": {
"name": "Mustapha Rasheed",
"phoneNumber": "07060823006"
},
"payee": {
"name": "Rami Nigeria Limited"
},
"expiryDateTimeUTC": "2022-04-26T16:35:00",
"isSuppressMessages": true,
"payerCollectionFeeShare": 1,
"payeeCollectionFeeShare": 0,
"callBackUrl": "https://webhook.site/efda4728-139e-4efa-b5c3-d7fb24e28475?",
"paymentMethods": [
"REQUEST_MONEY"
]
}
Redirect the customer to the WebPaymentLink
You’ll redirect the customer to the generated weblink.
After Payment
POST /status HTTP/1.1
Host: collect.paga.com
hash: 1f42eb2a076147063285d6321a969376472c2b2710220051c1736386ff01ea0f9c4ff8ddf43cd8e497327760a2faad9139a4a3af38a1e2c2f68b56851a5a99f1
Authorization: Basic e3t1c7VybmFtZX19Ont7cGFzc3dvcmR9fb==
Content-Type: application/json
Content-Length: 51
{
"referenceNumber": "23534646579650395979"
}
{
"referenceNumber": "2460039509797",
"statusCode": "0",
"statusMessage": "success",
"data": {
"referenceNumber": "2460039509797",
"statusCode": "0",
"statusMessage": "success",
"requestAmount": 50.0,
"totalPaymentAmount": 50.41,
"currency": "NGN",
"paymentMethods": [
{
"name": "REQUEST_MONEY",
"properties": {
"PaymentReference": "0be92b6b-b057-4652-a773-2fc4f886637c",
"WebPaymentLink": "https://justpaga.me/0be92b6b-b057-4652-a773-2fc4f886637c"
}
}
],
"expiryDateTimeUTC": "2022-04-28T16:35:00",
"isPayerPagaAccountHolder": true
}
}
Check payment status
What if payment wasn’t made or completed
<p class="codepen" data-height="300" data-default-tab="html,result" data-slug-hash="bGayvya" data-user="raymonbell" style="height: 300px; box-sizing: border-box; display: flex; align-items: center; justify-content: center; border: 2px solid; margin: 1em 0; padding: 1em;">
<span>See the Pen <a href="https://codepen.io/raymonbell/pen/bGayvya">
Paga Checkout</a> by Ramon (<a href="https://codepen.io/raymonbell">@raymonbell</a>)
on <a href="https://codepen.io">CodePen</a>.</span>
</p>
<script async src="https://cpwebassets.codepen.io/assets/embed/ei.js"></script>
Updated over 2 years ago