Pay With Saved Token
To perform Moto Transactions (Merchant initiated / Subscription ), Follow the below Guidelines:
First, you need a Customer's card token which you will be able to get after a successful 3DS transaction through a simple Intention API explained Integration Guide and API Reference
Step 1:
To Pass a transaction with the token you will be using simple Intention Pay API explained in Integration Guide and API Reference while passing a Moto Integration ID in "Payment Methods" in request Parameters and you will receive a Payment "Key" in the response under "Payment_Keys", which you will be utilizing to pass in the next API "Pay with Saved Card Token"
Create Intention API
URL: <https://oman.paymob.com/v1/intention/>
Method: POST
source: Merchant's server
recipient: Paymob's server
Content: JSON
authorization-header: Token <secret_key>
{
"amount": 10,
"currency": "OMR",
"payment_methods": ["kindly pass your Moto Integration id"],
"items": [
{
"name": "Item name 1",
"amount": 10,
"description": "Watch",
"quantity": 1
}
],
"billing_data": {
"apartment": "6",
"first_name": "Ammar",
"last_name": "Sadek",
"street": "938, Al-Jadeed Bldg",
"building": "939",
"phone_number": "+96824480228",
"country": "OMN",
"email": "[email protected]",
"floor": "1",
"state": "Alkhuwair"
},
"customer": {
"first_name": "Ammar",
"last_name": "Sadek",
"email": "[email protected]",
"extras": {"re":"22"}
},
"extras": {"ee":22}
}
{
"payment_keys": [
{
"integration": 114,
"key": "xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"gateway_type": "OMANNET",
"iframe_id": null
}
],
"id": "pi_test_xxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxxx",
"intention_detail": {
"amount": 10,
"items": [
{
"name": "Item name 1",
"amount": 10,
"description": "Watch",
"quantity": 1
}
],
"currency": "OMR"
},
"client_secret": "pak_csk_test_xxxxxxxxxxxxxxxxxxxxxxxxx",
"payment_methods": [
{
"integration_id": 104,
"alias": null,
"name": "card",
"method_type": "online",
"currency": "OMR",
"live": false
},
{
"integration_id": 114,
"alias": null,
"name": "omannet",
"method_type": "online",
"currency": "OMR",
"live": false
}
],
"special_reference": null,
"extras": {
"creation_extras": {
"ee": 22
},
"confirmation_extras": null
},
"confirmed": false,
"status": "intended",
"created": "2023-09-07T15:48:04.446108+05:00",
"card_detail": null,
"object": "paymentintention"
}
Now you've received your customer's card token as well as the payment "Key", in order to perform recurring payments with this token, use below "Pay with saved Token" API
Prerequisites:
Please ask your technical contact for a recurring payment setup, you should receive extra integration ID in your dashboard.
Step 2:
Kindy pass the Customer's card token in "identifier" and the Payment Key which you have received in Step 1 in "payment_token" as in the below request body.
URL: https://oman.paymob.com/api/acceptance/payments/pay
method: POST
source: Merchant server
content-type: JSON
EXAMPLE BODY:
{ "source":
{
"identifier": "d20d94...8000687835c3f1a9da9",
"subtype": "TOKEN" ,
"cvn": 112 //you need to pass cvn for omannet moto transactions.
},
"payment_token": "ZXlKMGVYQWlULjRi2T2..."
}
Sample Response:
{
"type": "TRANSACTION",
"obj": {
"id": 78,
"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": 1,
"profile_id": 1,
"has_parent_transaction": false,
"order": {
"id": 94,
"created_at": "2016-12-26T06:49:16.651010Z",
"delivery_needed": false,
"merchant": {
"id": 1,
"created_at": "2016-11-17T15:02:53.646620Z",
"phones": [
"011111111111",
"012324151432"
],
"company_emails": [
"[email protected]",
"[email protected]"
],
"company_name": "Wuckert, Zieme and Dach",
"state": "Oklahoma",
"country": "Oman",
"city": "Port Arvillachester",
"postal_code": "83372",
"street": "Walker Ramp"
},
"collector": null,
"amount_cents": 100,
"shipping_data": {
"id": 73,
"first_name": "Clifford",
"last_name": "Nicolas",
"street": "Ethan Land",
"building": "8028",
"floor": "42",
"apartment": "803",
"city": "Jaskolskiburgh",
"state": "Utah",
"country": "CR",
"email": "[email protected]",
"phone_number": "+86(8)9135210486",
"postal_code": "01898",
"extra_description": "",
"shipping_method": "UNK",
"order_id": 94,
"order": 94
},
"currency": "AED",
"is_payment_locked": true,
"merchant_order_id": null,
"wallet_notification": null,
"paid_amount_cents": 0,
"items": []
},
"created_at": "2016-12-26T06:49:16.680871Z",
"transaction_processed_callback_responses": [],
"currency": "AED",
"source_data": {
"sub_type": "MasterCard",
"pan": "2346",
"type": "card"
},
"data": {
"merchant_txn_ref": "1_6b30848c28c455de9bcb0c693e9f85a3",
"card_num": null,
"avs_result_code": "Unsupported",
"order_info": "[email protected]",
"merchant": "TEST290510AED",
"avs_acq_response_code": "Unsupported",
"transaction_no": "2000004112",
"batch_no": "20161226",
"message": "Approved",
"txn_response_code": "0",
"secure_hash": "DF6CF1D9CFF09F9C6AE1EC86F6ED4BFE4E5BAE8CE7705ED05E61A264839FEA7A",
"card_type": "MC",
"receipt_no": "636117634097",
"created_at": "2016-12-26T06:49:19.593479",
"currency": "AED",
"klass": "VPCPayment",
"authorize_id": "634097",
"amount": "100",
"acq_response_code": "00",
"command": "pay",
"gateway_integration_pk": 1
},
"payment_key_claims": {
"exp": 1482770369,
"currency": "AED",
"amount_cents": 100,
"user_id": 2,
"card_integration_id": 1,
"shipping_data": {
"state": "Utah",
"country": "CR",
"first_name": "Clifford",
"last_name": "Nicolas",
"postal_code": "01898",
"floor": "42",
"city": "Jaskolskiburgh",
"street": "Ethan Land",
"building": "8028",
"phone_number": "+86(8)9135210486",
"extra_description": "",
"shipping_method": "PKG",
"apartment": "803",
"email": "[email protected]"
}
},
"error_occured": false,
"owner": 2,
"parent_transaction": null
}
}
Updated 6 months ago