Loyalty Points
The steps in this guide are following to the essential steps mentioned in the payment API flow guide, so please check it before proceeding to this guide
Pay Request:
Now that you have obtained payment key, there are 2 ways to proceed with the payment:
- Add iframe URL in your HTML:
- Pay Request
The pay request will be performed over 2 steps:
Step 1: Transaction creation
URL: https://accept.paymob.com/api/acceptance/payments/pay
method: POST
source: Merchant's server
recipient: Accept's server
content-type: JSON
example request data:
{
"source": {
"identifier": "01000397800", // phone number with loyalty points
"subtype": "LOYALTY"
},
"payment_token": "ZXlKMGVYQWlPaUpLVjFRaUxDSmhiRVXhN......" // payment key from step3
}
example response:
{
"message": "transaction created",
"reference": "0ca6ef4c6d0755008bcb38bbc448bebb"
}
Step2: Transaction Validation
URL: https://accept.paymob.com/api/acceptance/loyalty_checkout
method: POST
source: Merchant's server
recipient: Accept's server
content-type: JSON
example request data:
{
"reference": "0ca6ef4c6d0755008bcb38bbc448bebb", // reference from transaction creation
"otp": "611129", // one time pin received in sms
"payment_token": "ZXlKMGVYQWlPaUpLVjFRaUxDSmhiRVXhN......" // payment key from step3
}
example response data:
{
"id": 1433,
"pending": "false",
"amount_cents": 100,
"success": "true",
"is_auth": "false",
"is_capture": "false",
"is_standalone_payment": "true",
"is_voided": "false",
"is_refunded": "false",
"is_3d_secure": "false",
"integration_id": 183,
"profile_id": 1,
"has_parent_transaction": "false",
"order": 1624,
"created_at": "2019-01-09T14:39:53.414400",
"currency": "EGP",
"is_void": "false",
"is_refund": "false",
"error_occured": "false",
"refunded_amount_cents": 0,
"captured_amount": 0,
"merchant_staff_tag": "",
"accept_fees_cents": 0,
"vat_cents": 0,
"owner": 2,
"parent_transaction": "",
"merchant_order_id": "null",
"data.message": "Success",
"source_data.type": "loyalty",
"source_data.pan": "01000397800",
"source_data.sub_type": "LOYALTY",
"acq_response_code": 0,
"txn_response_code": 0,
"hmac":
"7a734c6e2fbe30cd4b9494841212e39f52d781d5edbf236245088c9d7b40eb7fff9bab3ab7426118
0309156545fe979b5837bbca7d5503e8a9d7958e3098624e",
"merchant_txn_ref": "null",
"use_redirection": "true",
"redirection_url": "https://accept.paymobsolutions.com/api/acceptance/post_pay?profile_id=1&is_refunded=false&is_void=false&owner=2&created_at=2019-01-09T14%3A39%3A53.414400&is_refund=false&captured_amount=0&refunded_amount_cents=0&vat_cents=0&order=1624&hmac=7a734c6e2fbe30cd4b9494841212e39f52d781d5edbf236245088c9d7b40eb7fff9bab3ab74261180309156545fe979b5837bbca7d5503e8a9d7958e3098624e&is_standalone_payment=true&txn_response_code=0&is_capture=false&accept_fees_cents=0&integration_id=183&is_voided=false&is_3d_secure=false&pending=false&has_parent_transaction=false&is_auth=false&amount_cents=100&source_data.sub_type=LOYALTY&source_data.type=loyalty&id=1433&data.message=Invalid+pin+code&source_data.pan=01000397800&success=true&acq_response_code=0&error_occured=false¤cy=EGP",
"merchant_response": "ok",
"bypass_step_six": "true"
}
Response codes
acq_response_code | message |
---|---|
0 | Success |
2 | Invalid customer number |
3 | Insufficient funds |
4 | Invalid pin code |
5 | Merchant not found |
7 | Balance invalid |
8 | Inactive customer number |
-1 | Transaction Declined |
That's it, you've successfully finalized your Loyalty points payments integration with Accept .
Now, prepare endpoints to receive payment notifications from Accept's server, to learn more about the transactions webhooks, please check this guide.
Updated 5 months ago