Prerequisite
- Enable Pinless from the EasyPaisa team on your MID(s).
- Enable Tokenization from the EasyPaisa team to ensure a smooth Pinless flow.
1. Create Payment Intent for Tokenization
To initiate the EasyPaisa Pinless Tokenization flow, pass reason: "token" in the metadata payload.
JSON
{
"metadata": {
"reason": "token"
}
}Amount Range: PKR 300 – PKR 3,000
Each attempt must use a new Order ID, as required by EasyPaisa.
cURL
JavaScript
curl --location --globoff '{{baseUrl}}/public/v1/payment/intent' \
--header 'x-api-key: {{x-api-key-sk}}' \
--header 'x-account-id: {{x-account-id}}' \
--header 'x-signature: {{x-signature}}' \
--header 'Content-Type: application/json' \
--data-raw '{
"amount": 500,
"currency": "PKR",
"customer": {
"email": "user@gmail.com",
"name": "email user",
"phone": "03000000000",
"vip_customer": "Yes",
"previous_customer": "Yes"
},
"shipping": {
"address1": "Gulberg123",
"city": "Lahore",
"country": "pakistan",
"zip": "65191",
"shipping_method": "Standard",
"province": "Punjab"
},
"billingAddress": {
"address1": "gullberg",
"city": "jhang",
"country": "pakistan",
"zip": "65191",
"shipping_method": "Standard",
"province": "Punjab"
},
"product": {
"product_category": "Ticketing",
"product_name": "Bus",
"no_of_items": "1"
},
"metadata": {
"order_reference": "easypaise-pinless",
"reason": "token"
}
}'2. Complete Tokenization
When the HTML/pop-up loads:
- Enter the OTP received on your registered phone number.
- Approve the payment through the EasyPaisa app.
- If the payment is successfully captured, the token will be received in the webhook.
3. Continue Payment Fallback
If the amount does not meet the EasyPaisa Pinless amount requirement and the merchant wants to continue with the normal EasyPaisa payment flow, pass continue_payment: true in the metadata.
JSON
{
"metadata": {
"reason": "token",
"continue_payment": true
}
}4. Token Payment
Once the token is received, pass the token in the Tokenized Payment API to perform the token payment.
Amount Range: PKR 300 – PKR 3,000
The PKR 300–3,000 amount range applies to both token creation and token payments.
cURL
JavaScript
curl --location --globoff '{{base_url}}/public/v1/payment/intent/tokenized/payment' \
--header 'x-api-key: {{x-api-key}}' \
--header 'x-account-id: {{x-account-id}}' \
--header 'x-signature: {{x-signature}}' \
--header 'Content-Type: application/json' \
--header 'x-idempotency-key: bookme' \
--data-raw '{
"token": "xpay_token_f79e5918aXXXXXXXXXX",
"payment_method_types": "token",
"amount": "1000",
"currency": "PKR",
"customer": {
"name": "user",
"email": "user@gmail.com",
"phone": "923458889876"
},
"shipping": {
"address1": "Gulberg",
"city": "Lahore",
"country": "Pakistan",
"zip": "65191"
},
"metadata": {
"order_reference": "easypaisaToken"
}
}'