Language
Tools
Step 4: Check the payment status
Once a payment has been created, you can check the status of the newly created payment by retrieving the payment by its URL.
Request and response
GET https://sandbox.kopokopo.com/api/v1/payments/d76265cd-0951-e511-80da-0aa34a9b2388
Accept: application/json
Authorization: Bearer 0Sn0W6kzNicvoWhDbQcVSKLRUpGjIdlPSEYyrHqrDDoRnQwE7Q
{
"data": {
"id": "c6fda139-2480-4a93-95ed-f72c66b92364",
"type": "payment",
"attributes": {
"status": "Processed",
"created_at": "2021-01-28T10:00:17.827+03:00",
"amount": {
"currency": "KES",
"value": 20000
},
"transfer_batches": [
{
"status": "Transferred",
"disbursements": [
{
"amount": "20000.0",
"status": "Transferred",
"destination_type": "Mobile Wallet",
"origination_time": "2020-11-13T08:32:03.000+03:00",
"destination_reference": "c7f300c0-f1ef-4151-9bbe-005005aa3747",
"transaction_reference": "LBA10034460"
}
]
}
],
"metadata": {
"notes": "Salary payment for May 2018",
"customerId": "8675309",
"something_else": "Something else"
},
"_links": {
"callback_url": "https://webhook.site/3856ff77-93eb-4130-80cd-e62dc0db5c1a",
"self": "https://sandbox.kopokopo.com/api/v1/payments/c6fda139-2480-4a93-95ed-f72c66b92364"
}
}
}
}
payment_url = 'https://sandbox.kopokopo.com/api/v1/payments/d76265cd-0951-e511-80da-0aa34a9b2388'
# Using K2Connect - https://github.com/kopokopo/k2-connect-ruby (Recommended)
k2_pay = K2Pay.new('your_access_token')
k2_pay.query_resource(payment_url)
var paymentUrl = 'https://sandbox.kopokopo.com/api/v1/payments/d76265cd-0951-e511-80da-0aa34a9b2388'
// Using KopoKopoConnect - https://github.com/kopokopo/k2-connect-node (Recommended)
var PayService = K2.PayService
PayService
.getStatus({accessToken: 'myRand0mAcc3ssT0k3n', location: paymentUrl})
.then(response => {
console.log(response)
})
.catch(error => {
console.log(error)
})
create_pay_location_url = 'https://sandbox.kopokopo.com/api/v1/payments/d76265cd-0951-e511-80da-0aa34a9b2388'
k2connect.initialize(CLIENT_ID, CLIENT_SECRET, BASE_URL)
pay_service = k2connect.Pay
# Using K2Connect - https://github.com/kopokopo/k2-connect-python (Recommended)
pay_request_query = pay_service.pay_transaction_status(ACCESS_TOKEN, create_pay_location_url)
<?
// Using KopoKopoConnect - https://github.com/kopokopo/k2-connect-php (Recommended)
$pay = $K2->PayService();
$options = [
'location' => 'https://sandbox.kopokopo.com/api/v1/payments/d76265cd-0951-e511-80da-0aa34a9b2388',
'accessToken' => 'myRand0mAcc3ssT0k3n',
];
$response = $pay->getStatus($options);
echo $response
That’s it! You’ve successfully transferred money to a recipient. Please continue to the Webhooks guide for information on implementing notifications for your customers about the status of the transfer.
© 2024 Kopo Kopo, Inc.