{"info":{"_postman_id":"43261c9d-fee7-4d98-94c4-b99728903ed0","name":"XPay","schema":"https://schema.getpostman.com/json/collection/v2.0.0/collection.json","toc":[],"description":"<html><head></head><body></body></html>","owner":"21124817","collectionId":"43261c9d-fee7-4d98-94c4-b99728903ed0","publishedId":"2s93Jxr1gh","public":true,"customColor":{"top-bar":"FFFFFF","right-sidebar":"303030","highlight":"7766EE"},"publishDate":"2024-04-25T12:10:16.000Z"},"item":[{"name":"XPay Fusion","item":[{"name":"Payment Flow","item":[{"name":"Create Payment Intent","event":[{"listen":"prerequest","script":{"id":"3d14e12c-f997-4eb2-91e4-c8e7a907357d","exec":["// Access the current request body","let requestBody = pm.request.body;","// Parse the request body as JSON","let parsedBody;","try {    parsedBody = JSON.parse(requestBody);} ","catch (e) {    // Handle JSON parsing error   ","console.error('Error parsing request body as JSON:', e);}","if (parsedBody) {    // Modify the order_reference field with a random value    ","// parsedBody.metadata.order_reference = \"Order-\"+ Math.floor(Math.random() * 100000);    ","// Convert the modified request body back to JSON string    ","let modifiedPayload = JSON.stringify(parsedBody);    ","// Set the modified payload back to the request body    ","pm.request.body = {        mode: 'raw',        raw: modifiedPayload    };    ","// Continue with generating the signature   "," const ApiHMac = pm.environment.get('api_hmac_key'); "," // Replace with your actual secret key    "," const hash = CryptoJS.HmacSHA256(modifiedPayload, ApiHMac).toString(CryptoJS.enc.Hex);    "," // Set the signature as an environment variable for later use in headers    "," pm.environment.set('x-signature', hash);}","",""],"type":"text/javascript","packages":{},"requests":{}}},{"listen":"test","script":{"id":"8373762f-13c8-4a0f-bcf7-3cb8fde605e1","exec":[""],"type":"text/javascript","packages":{},"requests":{}}}],"id":"71612807-942d-43d4-aa9c-8e9d47ee609d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Acccount Id</p>\n"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 500,\n    \"currency\": \"PKR\",\n    \"payment_method_types\": \"card\",\n    \"customer\": {\n        \"name\": \"Necibe Mirzai\",\n        \"email\": \"necibe.mirzai@xstak.com\",\n        \"phone\": \"905374182171\",\n        \"vip_customer\": \"No\", // optional\n        \"previous_customer\": \"false\" // optional\n    },\n    \"shipping\": {\n        // Omit the entire `shipping` object if shipping details are not required\n        \"address1\": \"Model Town Block C\", // optional\n        \"city\": \"Karachi\", // optional\n        \"country\": \"Pakistan\", // optional\n        \"zip\": \"75500\", // optional\n        \"shipping_method\": \"Standard\", // optional\n        \"province\": \"Punjab\" // optional\n    },\n    \"billingAddress\": {\n        // Omit the entire `billingAddress` object if billing details are not required\n        \"address1\": \"DHA Phase 2\", // optional\n        \"city\": \"Islamabad\", // optional\n        \"country\": \"Pakistan\", // optional\n        \"zip\": \"44000\", // optional\n        \"shipping_method\": \"Standard\", // optional\n        \"province\": \"Islamabad\" // optional\n    },\n    \"product\": {\n        // Omit the entire `product` object if product details are not required\n        \"product_category\": \"Transport\", // optional\n        \"product_name\": \"Intercity Travel\", // optional\n        \"no_of_items\": \"2\" // optional\n    },\n    \"gateway_instance_id\": \"gateway_pk_01\", // Add when routing payment through a specific gateway instance\n    \"metadata\": {\n        \"order_reference\": \"3242424234r23er\",\n        \"check_network_blocklist\": false, // Add to check whether the user/network is blocked at XPay level\n        \"skip_blocklist\": true, // Add when blocklist is enabled but should be skipped\n        \"continue_payment\": true // Add when token limit is exceeded but payment should continue\n    }\n}"},"url":"{{base_url}}/public/v1/payment/intent","description":"<h3 id=\"order-id-as-idempotency-key\"><strong>Order ID as Idempotency Key</strong></h3>\n<p>XPay considers the order ID as idempotency key and once a PI is created using an order ID, the subsequent create PI API calls with the same order ID will return the object returned on the first attempt.</p>\n<p>So, if you want to update the amount or another value after a PI is created, the update PI API is to be used.</p>\n<h3 id=\"supporting-multiple-payment-gateways-and-currency-mids-with-one-xpay-account-and-website\"><strong>Supporting multiple payment gateways and currency MIDs with one XPay account and website</strong></h3>\n<p>You can add multiple PSPs in XPay. Add a gateway instance in the store gateway settings and add the ID of the instance in the <em><strong>gateway_instance_id</strong></em> field. By adding this you can support multiple payment gateways and MIDs for currencies on the same XPay account.</p>\n<h3 id=\"separate-authorization-and-capture\"><strong>Separate Authorization and Capture</strong></h3>\n<p>To authorize an amount and capture it later, add the following in the PI API payload.</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code>\"capture_method\": \"manual\"\n\n</code></pre>","urlObject":{"path":["public","v1","payment","intent"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"de2e6fe7-b030-4d41-b68f-126d12d4e5b3","name":"Create Payment Intent","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"x-signature","value":"{{x-signature}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 500,\n    \"currency\": \"PKR\",\n    \"payment_method_types\": \"card\",\n    \"customer\": {\n        \"name\": \"Necibe Mirzai\",\n        \"email\": \"necibe.mirzai@xstak.com\",\n        \"phone\": \"905374182171\",\n        \"vip_customer\": \"No\", // optional\n        \"previous_customer\": \"false\" // optional\n    },\n    \"shipping\": {\n        // Omit the entire `shipping` object if shipping details are not required\n        \"address1\": \"Model Town Block C\", // optional\n        \"city\": \"Karachi\", // optional\n        \"country\": \"Pakistan\", // optional\n        \"zip\": \"75500\", // optional\n        \"shipping_method\": \"Standard\", // optional\n        \"province\": \"Punjab\" // optional\n    },\n    \"billingAddress\": {\n        // Omit the entire `billingAddress` object if billing details are not required\n        \"address1\": \"DHA Phase 2\", // optional\n        \"city\": \"Islamabad\", // optional\n        \"country\": \"Pakistan\", // optional\n        \"zip\": \"44000\", // optional\n        \"shipping_method\": \"Standard\", // optional\n        \"province\": \"Islamabad\" // optional\n    },\n    \"product\": {\n        // Omit the entire `product` object if product details are not required\n        \"product_category\": \"Transport\", // optional\n        \"product_name\": \"Intercity Travel\", // optional\n        \"no_of_items\": \"2\" // optional\n    },\n    \"gateway_instance_id\": \"gateway_pk_01\", // Add when routing payment through a specific gateway instance\n    \"metadata\": {\n        \"order_reference\": \"3242424234r23er\",\n        \"check_network_blocklist\": false, // Add to check whether the user/network is blocked at XPay level\n        \"skip_blocklist\": true, // Add when blocklist is enabled but should be skipped\n        \"continue_payment\": true // Add when token limit is exceeded but payment should continue\n    }\n}"},"url":"{{base_url}}/public/v1/payment/intent"},"status":"OK","code":200,"_postman_previewlanguage":"","header":[{"key":"Date","value":"Fri, 09 Jan 2026 08:18:44 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"2094"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"82e-x+Qlqn2Gc1yxyYzJdTeHkgNgPtk\""}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_pi_989b47506fdaccb3089360e927dc812332042ce05c1ab42ad94c4d10cd581ecf\",\n        \"pi_client_secret\": \"xpay_pi_989b47506fdaccb3089360e927dc812332042ce05c1ab42ad94c4d10cd581ecf_cs_8c9b702b0e279c88f58bae5f64d2a820729f075527cfbb1c813127f1dd28ec1e\",\n        \"created_at\": \"2026-01-09T07:05:42.982Z\",\n        \"amount\": 500,\n        \"currency\": \"PKR\",\n        \"refund\": {\n            \"refunded_amount\": 0,\n            \"refund_object_id\": null\n        },\n        \"object_name\": \"payment_intent\",\n        \"payment_method_types\": \"card\",\n        \"customer\": {\n            \"name\": \"Necibe Mirzai\",\n            \"email\": \"necibe.mirzai@xstak.com\",\n            \"phone\": \"905374182171\",\n            \"vip_customer\": \"No\",\n            \"previous_customer\": \"false\"\n        },\n        \"description\": \"Full one-time payment payload for testing\",\n        \"pi_status\": \"requires_payment_method\",\n        \"pm_token\": \"\",\n        \"shipping\": {\n            \"address1\": \"Model Town Block C\",\n            \"address2\": \"\",\n            \"city\": \"Karachi\",\n            \"country\": \"Pakistan\",\n            \"firstName\": \"\",\n            \"lastName\": \"\",\n            \"phone\": \"\",\n            \"province\": \"Punjab\",\n            \"zip\": \"75500\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"metadata\": {\n            \"order_reference\": \"3242424234r23er\",\n            \"check_network_blocklist\": false,\n            \"internal_notes\": \"Full one-time payment payload\"\n        },\n        \"token\": null,\n        \"capture_method\": \"automatic\",\n        \"return_url\": null,\n        \"html_response\": {\n            \"hidden\": true\n        },\n        \"bank_response\": {},\n        \"last_payment_response\": {\n            \"token\": null\n        },\n        \"encryptionKey\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAv9KgF5tUMir+o37luHh2\\nARemLi3uQJ9Aw95Riy0KfhplPE2ongspGQ/M5H/34JO8nCNIU62l9NJV07gr2ySv\\nYy24o5X0GR+HldL7IVq5wmzMqyGjiAf9Ms93QWIyWRy6vkWKj9fPtHC+mmovFbzK\\nO9F2YFb/Ghb8Y/ZWNpqxiDHd5hgNS5uaPV+b/V87kVDokjIEGY6tUyb3u668hRDJ\\nJ94pxrtyfeaqEQsyRq0KyCwISchVkiDhvQQVFRAcEZuSoYoNB0410LusxuFk6xQ1\\nmhi0xYpYigtakXz7J8oLzj0C1Ip3r8x6C4hXPNz1OFCqWYyxlwZfRH6frwDwpRs7\\ngwIDAQAB\\n-----END PUBLIC KEY-----\\n\",\n        \"product\": {\n            \"product_name\": \"Intercity Travel\",\n            \"product_category\": \"Transport\",\n            \"no_of_items\": \"2\",\n            \"_id\": \"6960b9e4e8c395c64805bd64\"\n        },\n        \"billingAddress\": {\n            \"address1\": \"DHA Phase 2\",\n            \"city\": \"Islamabad\",\n            \"country\": \"Pakistan\",\n            \"province\": \"Islamabad\",\n            \"zip\": \"44000\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"routing_rules_history\": [],\n        \"subscription\": {},\n        \"checkout_page_url\": null,\n        \"dqr_data\": null\n    }\n}"}],"_postman_id":"71612807-942d-43d4-aa9c-8e9d47ee609d"},{"name":"Capture an authorized amount","id":"3f8de28b-6f1a-448d-8e52-8889cef8b9d3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 10 //only add an amount if you need to capture partial amount.\n}"},"url":"{{base_url}}/public/v1/payment/intent/capture?pi_client_secret={{pi_client_secret}}","description":"<p>This API allows you to capture funds against a payment that has already been successfully authorized, completing the transaction by transferring the authorized amount to the merchant.</p>\n","urlObject":{"path":["public","v1","payment","intent","capture"],"host":["{{base_url}}"],"query":[{"key":"pi_client_secret","value":"{{pi_client_secret}}"}],"variable":[]}},"response":[{"id":"58e6bf20-1393-48f8-ac53-d94e63e01534","name":"Capture an authorized amount","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"x-signature","value":"{{x-signature}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 10 //only add an amount if you need to capture partial amount.\n}"},"url":{"raw":"{{base_url}}/public/v1/payment/intent/capture?pi_client_secret={{pi_client_secret}}","host":["{{base_url}}"],"path":["public","v1","payment","intent","capture"],"query":[{"key":"pi_client_secret","value":"{{pi_client_secret}}"}]}},"status":"OK","code":200,"_postman_previewlanguage":"","header":[{"key":"Date","value":"Fri, 09 Jan 2026 10:01:27 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"2118"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"846-pJNz3itPsCEXh+sALoGD4BHf3Es\""}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5\",\n        \"pi_client_secret\": \"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5_cs_912161d25e980fc4add787dc97c53e53ba409a1847ab42e63b7524ee4ba22d59\",\n        \"created_at\": \"2026-01-09T10:01:10.273Z\",\n        \"last_update\": \"2026-01-09T10:01:27.318Z\",\n        \"amount\": 500,\n        \"currency\": \"PKR\",\n        \"refund\": {\n            \"refunded_amount\": 0,\n            \"refund_object_id\": null\n        },\n        \"object_name\": \"payment_intent\",\n        \"payment_method_types\": \"card\",\n        \"customer\": {\n            \"name\": \"Guest User\",\n            \"email\": \"necibe.mirzai@xstak.com\",\n            \"phone\": \"905374182171\"\n        },\n        \"description\": \"\",\n        \"pi_status\": \"succeeded\",\n        \"pm_token\": \"\",\n        \"shipping\": {\n            \"address1\": \"Model Town Block C\",\n            \"address2\": \"\",\n            \"city\": \"Karachi\",\n            \"country\": \"Pakistan\",\n            \"firstName\": \"\",\n            \"lastName\": \"\",\n            \"phone\": \"\",\n            \"province\": \"Punjab\",\n            \"zip\": \"75500\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"metadata\": {\n            \"order_reference\": \"32424ew24e234r23er\",\n            \"check_network_blocklist\": false,\n            \"skip_blocklist\": true,\n            \"continue_payment\": true\n        },\n        \"token\": \"\",\n        \"capture_method\": \"manual\",\n        \"return_url\": null,\n        \"bank_response\": {},\n        \"last_payment_response\": {\n            \"error\": false,\n            \"status\": \"PAYMENT_PARTIALLY_CAPTURED\",\n            \"message\": \"The payment was completed successfully\",\n            \"token\": \"\"\n        },\n        \"encryptionKey\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAurrqnO+Jr22aprjFycPc\\niYSapjNU2wuUP8Gj37ENopiohrKTukjXrB93q3b1b8rhwqoGwwZrV295jpAEyPeh\\n1e5OAOQotY0jeU5RHxq6etCBTNdt76JwhJj5g+d+l1cvABgLUSHr+C7zSu/hrPc6\\nYnWNlFrCYo/fUJO7mX96b/5x4znqovomrOcclbXs7hCDyazucRCN9TAhPK13pcFy\\n4qxBuud4WHh1btR7E7zQA0zgrtKTjPQVWM83XFygzrWFkmGSVMVH0tDi9opbY38X\\nKw4sa+8B3MHEOH483o3mzPP9SwppZJgk858ANsK+pwhKbYI4hWKdWCkvI3bK8fzK\\nfQIDAQAB\\n-----END PUBLIC KEY-----\\n\",\n        \"product\": {\n            \"product_name\": \"Intercity Travel\",\n            \"product_category\": \"Transport\",\n            \"no_of_items\": \"2\",\n            \"_id\": \"6960d1e6e8c395c64805bef3\"\n        },\n        \"billingAddress\": {\n            \"address1\": \"DHA Phase 2\",\n            \"city\": \"Islamabad\",\n            \"country\": \"Pakistan\",\n            \"province\": \"Islamabad\",\n            \"zip\": \"44000\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"routing_rules_history\": [],\n        \"gateway\": \"bank-alfalah\",\n        \"subscription\": {},\n        \"checkout_page_url\": null,\n        \"dqr_data\": null\n    }\n}"}],"_postman_id":"3f8de28b-6f1a-448d-8e52-8889cef8b9d3"},{"name":"Retrieve Payment Intent","id":"f3342589-a938-4557-b512-47d3b0f5b3df","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"}],"url":"{{base_url}}/public/v1/payment/intent/details/:pi_id","urlObject":{"path":["public","v1","payment","intent","details",":pi_id"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"pi_id"}]}},"response":[{"id":"bf4f13a3-c7f2-4cbc-b05f-56d3af3eb5af","name":"Retrieve Payment Intent","originalRequest":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"}],"url":{"raw":"{{base_url}}/public/v1/payment/intent/details/:pi_id","host":["{{base_url}}"],"path":["public","v1","payment","intent","details",":pi_id"],"variable":[{"key":"pi_id","value":"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5"}]}},"status":"OK","code":200,"_postman_previewlanguage":"","header":[{"key":"Date","value":"Fri, 09 Jan 2026 10:02:10 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"2118"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"846-pJNz3itPsCEXh+sALoGD4BHf3Es\""}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5\",\n        \"pi_client_secret\": \"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5_cs_912161d25e980fc4add787dc97c53e53ba409a1847ab42e63b7524ee4ba22d59\",\n        \"created_at\": \"2026-01-09T10:01:10.273Z\",\n        \"last_update\": \"2026-01-09T10:01:27.318Z\",\n        \"amount\": 500,\n        \"currency\": \"PKR\",\n        \"refund\": {\n            \"refunded_amount\": 0,\n            \"refund_object_id\": null\n        },\n        \"object_name\": \"payment_intent\",\n        \"payment_method_types\": \"card\",\n        \"customer\": {\n            \"name\": \"Guest User\",\n            \"email\": \"necibe.mirzai@xstak.com\",\n            \"phone\": \"905374182171\"\n        },\n        \"description\": \"\",\n        \"pi_status\": \"succeeded\",\n        \"pm_token\": \"\",\n        \"shipping\": {\n            \"address1\": \"Model Town Block C\",\n            \"address2\": \"\",\n            \"city\": \"Karachi\",\n            \"country\": \"Pakistan\",\n            \"firstName\": \"\",\n            \"lastName\": \"\",\n            \"phone\": \"\",\n            \"province\": \"Punjab\",\n            \"zip\": \"75500\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"metadata\": {\n            \"order_reference\": \"32424ew24e234r23er\",\n            \"check_network_blocklist\": false,\n            \"skip_blocklist\": true,\n            \"continue_payment\": true\n        },\n        \"token\": \"\",\n        \"capture_method\": \"manual\",\n        \"return_url\": null,\n        \"bank_response\": {},\n        \"last_payment_response\": {\n            \"error\": false,\n            \"status\": \"PAYMENT_PARTIALLY_CAPTURED\",\n            \"message\": \"The payment was completed successfully\",\n            \"token\": \"\"\n        },\n        \"encryptionKey\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAurrqnO+Jr22aprjFycPc\\niYSapjNU2wuUP8Gj37ENopiohrKTukjXrB93q3b1b8rhwqoGwwZrV295jpAEyPeh\\n1e5OAOQotY0jeU5RHxq6etCBTNdt76JwhJj5g+d+l1cvABgLUSHr+C7zSu/hrPc6\\nYnWNlFrCYo/fUJO7mX96b/5x4znqovomrOcclbXs7hCDyazucRCN9TAhPK13pcFy\\n4qxBuud4WHh1btR7E7zQA0zgrtKTjPQVWM83XFygzrWFkmGSVMVH0tDi9opbY38X\\nKw4sa+8B3MHEOH483o3mzPP9SwppZJgk858ANsK+pwhKbYI4hWKdWCkvI3bK8fzK\\nfQIDAQAB\\n-----END PUBLIC KEY-----\\n\",\n        \"product\": {\n            \"product_name\": \"Intercity Travel\",\n            \"product_category\": \"Transport\",\n            \"no_of_items\": \"2\",\n            \"_id\": \"6960d1e6e8c395c64805bef3\"\n        },\n        \"billingAddress\": {\n            \"address1\": \"DHA Phase 2\",\n            \"city\": \"Islamabad\",\n            \"country\": \"Pakistan\",\n            \"province\": \"Islamabad\",\n            \"zip\": \"44000\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"routing_rules_history\": [],\n        \"gateway\": \"bank-alfalah\",\n        \"subscription\": {},\n        \"checkout_page_url\": null,\n        \"dqr_data\": null\n    }\n}"}],"_postman_id":"f3342589-a938-4557-b512-47d3b0f5b3df"},{"name":"Delete Payment Intent","id":"0c78b9f7-c2ea-4972-a767-c37de98b87a3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"}],"url":"{{base_url}}/public/v1/payment/Intent/:pi_id","urlObject":{"path":["public","v1","payment","Intent",":pi_id"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":null,"key":"pi_id"}]}},"response":[],"_postman_id":"0c78b9f7-c2ea-4972-a767-c37de98b87a3"},{"name":"Update Payment Intent","id":"6d229498-e1e0-4778-b05d-de6f224e9cef","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 10\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/payment/intent/:pi_id","description":"<p>The Payment Intent can only be updated if it's status is either Requires_Action or Requires_Payment_Method</p>\n","urlObject":{"path":["public","v1","payment","intent",":pi_id"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"pi_id"}]}},"response":[{"id":"99c719fa-3234-4e6a-9563-00b78d4af645","name":"Update Payment Intent","originalRequest":{"method":"PUT","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"x-signature","value":"{{x-signature}}","type":"text"}],"body":{"mode":"raw","raw":"{\n    \"amount\": 10\n}","options":{"raw":{"language":"json"}}},"url":{"raw":"{{base_url}}/public/v1/payment/intent/:pi_id","host":["{{base_url}}"],"path":["public","v1","payment","intent",":pi_id"],"variable":[{"key":"pi_id","value":"xpay_pi_c0979f8b3abdf3c24d99088b593de250dbae0f869db0fe6f910adc8604bf4a9c"}]}},"status":"OK","code":200,"_postman_previewlanguage":"","header":[{"key":"Date","value":"Fri, 09 Jan 2026 10:02:56 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"2050"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"802-WPxpLgSMwzMb5j/bQ1rIrCZRwMU\""}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_pi_c0979f8b3abdf3c24d99088b593de250dbae0f869db0fe6f910adc8604bf4a9c\",\n        \"pi_client_secret\": \"xpay_pi_c0979f8b3abdf3c24d99088b593de250dbae0f869db0fe6f910adc8604bf4a9c_cs_ece262c5bcb16adba2fc2dccc98038c9ae4785b05f3fffd942f418723ceb68ca\",\n        \"created_at\": \"2026-01-09T10:02:49.929Z\",\n        \"amount\": 10,\n        \"currency\": \"PKR\",\n        \"refund\": {\n            \"refunded_amount\": 0,\n            \"refund_object_id\": null\n        },\n        \"object_name\": \"payment_intent\",\n        \"payment_method_types\": \"card\",\n        \"customer\": {\n            \"name\": \"Necibe Mirzai\",\n            \"email\": \"necibe.mirzai@xstak.com\",\n            \"phone\": \"905374182171\",\n            \"vip_customer\": \"No\",\n            \"previous_customer\": \"false\"\n        },\n        \"description\": \"\",\n        \"pi_status\": \"requires_payment_method\",\n        \"pm_token\": \"\",\n        \"shipping\": {\n            \"address1\": \"Model Town Block C\",\n            \"address2\": \"\",\n            \"city\": \"Karachi\",\n            \"country\": \"Pakistan\",\n            \"firstName\": \"\",\n            \"lastName\": \"\",\n            \"phone\": \"\",\n            \"province\": \"Punjab\",\n            \"zip\": \"75500\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"metadata\": {\n            \"order_reference\": \"32424ew24e2e34r23er\",\n            \"check_network_blocklist\": false,\n            \"skip_blocklist\": true,\n            \"continue_payment\": true\n        },\n        \"token\": null,\n        \"capture_method\": \"manual\",\n        \"return_url\": null,\n        \"html_response\": {\n            \"hidden\": true\n        },\n        \"bank_response\": {},\n        \"last_payment_response\": {\n            \"token\": null\n        },\n        \"encryptionKey\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEAz8NTbh/yGmhFRtxB9ky+\\n7zKEWa0QtGxbnOZuydDzfQiVsbDTWagBhHxl6chuYk/i6NhO4zOuFOuLb/PLJJK8\\nUbD7AewWwo8cj2IFwPVebjnzQEFE0zVKfHnjkilwUY3aUdxwy46/kQmjiXCccDch\\nCHpGQj9xEpBmw9vSKKLfgG+Jnrv5gHyUxYxOKkdTZ1OKbnWS7O9AhEo3+q41uS9x\\n/BWsYg5Y8a1vlsrAf2fme3B8II2TTN6374lH/fsT0XU4lUShBCDAo5WN4dQwqXYv\\nM6H6sH6HDgN16pm69UK8sWrgX6wbS/c9uDQrvoYesa48UWWB0LeZZuJ8Sof3N6Bg\\nBQIDAQAB\\n-----END PUBLIC KEY-----\\n\",\n        \"product\": {\n            \"product_name\": \"Intercity Travel\",\n            \"product_category\": \"Transport\",\n            \"no_of_items\": \"2\",\n            \"_id\": \"6960d249a7be3a7efaa35be4\"\n        },\n        \"billingAddress\": {\n            \"address1\": \"DHA Phase 2\",\n            \"city\": \"Islamabad\",\n            \"country\": \"Pakistan\",\n            \"province\": \"Islamabad\",\n            \"zip\": \"44000\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"routing_rules_history\": [],\n        \"subscription\": {},\n        \"checkout_page_url\": null,\n        \"dqr_data\": null\n    }\n}"}],"_postman_id":"6d229498-e1e0-4778-b05d-de6f224e9cef"},{"name":"Fetch all payment intents","id":"7ca898c6-e0e5-4ed3-ba63-b11738bc93a7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"}],"url":"{{base_url}}/public/v1/payment/intent?offset=0&limit=2","description":"<p>This API can be used to retrieve all payments based on the parameters provided in the request. The response is paginated, and data can be fetched page-wise using the <code>offset</code> and <code>limit</code> parameters.</p>\n","urlObject":{"path":["public","v1","payment","intent"],"host":["{{base_url}}"],"query":[{"disabled":true,"description":{"content":"<p>Find a specific  email address</p>\n","type":"text/plain"},"key":"email","value":""},{"disabled":true,"description":{"content":"<p>Find a specific  phone number</p>\n","type":"text/plain"},"key":"phone","value":""},{"disabled":true,"description":{"content":"<p>Find a specific  by order ID</p>\n","type":"text/plain"},"key":"order","value":""},{"disabled":true,"description":{"content":"<p>Find a specific using intent id</p>\n","type":"text/plain"},"key":"paymentIntentId","value":""},{"disabled":true,"description":{"content":"<p>format: 2024-10-03</p>\n","type":"text/plain"},"key":"start_date","value":""},{"disabled":true,"description":{"content":"<p>format: 2024-10-03</p>\n","type":"text/plain"},"key":"end_date","value":""},{"disabled":true,"description":{"content":"<p>Find a specific using payment method : card | wallet</p>\n","type":"text/plain"},"key":"paymentType","value":""},{"description":{"content":"<p>start offset</p>\n","type":"text/plain"},"key":"offset","value":"0"},{"description":{"content":"<p>Max value should 100</p>\n","type":"text/plain"},"key":"limit","value":"2"}],"variable":[]}},"response":[{"id":"0b97b9d2-a09e-43eb-a85b-63cee4f0bed5","name":"Fetch all payment intents","originalRequest":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"Secret API Key"},{"key":"x-account-id","value":"{{x-account-id}}","description":"XStak Account ID"}],"url":{"raw":"{{base_url}}/public/v1/payment/intent?offset=0&limit=2","host":["{{base_url}}"],"path":["public","v1","payment","intent"],"query":[{"key":"email","value":"","description":"Find a specific  email address","disabled":true},{"key":"phone","value":"","description":"Find a specific  phone number","disabled":true},{"key":"order","value":"","description":"Find a specific  by order ID","disabled":true},{"key":"paymentIntentId","value":"","description":"Find a specific using intent id","disabled":true},{"key":"start_date","value":"","description":"format: 2024-10-03","disabled":true},{"key":"end_date","value":"","description":"format: 2024-10-03","disabled":true},{"key":"paymentType","value":"","description":"Find a specific using payment method : card | wallet","disabled":true},{"key":"offset","value":"0","description":"start offset"},{"key":"limit","value":"2","description":"Max value should 100"}]}},"status":"OK","code":200,"_postman_previewlanguage":"","header":[{"key":"Date","value":"Fri, 09 Jan 2026 10:05:57 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"3334"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"d06-s6jV5Sviu8EsM9fL4tDaODL5Dto\""}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"docs\": [\n            {\n                \"_id\": \"xpay_pi_c0979f8b3abdf3c24d99088b593de250dbae0f869db0fe6f910adc8604bf4a9c\",\n                \"account_id\": \"0ddb82950784f875\",\n                \"store_id\": \"670cc16ca4f54be748916396\",\n                \"metadata\": {\n                    \"order_reference\": \"32424ew24e2e34r23er\",\n                    \"check_network_blocklist\": false,\n                    \"skip_blocklist\": true,\n                    \"continue_payment\": true\n                },\n                \"pi_client_secret\": \"xpay_pi_c0979f8b3abdf3c24d99088b593de250dbae0f869db0fe6f910adc8604bf4a9c_cs_ece262c5bcb16adba2fc2dccc98038c9ae4785b05f3fffd942f418723ceb68ca\",\n                \"status\": \"requires_payment_method\",\n                \"created_at\": \"2026-01-09T10:02:49.929Z\",\n                \"last_used\": null,\n                \"mode\": \"test\",\n                \"refund_data\": {\n                    \"refunded_amount\": 0,\n                    \"refund_obj_id\": null\n                },\n                \"__v\": 0,\n                \"createdAt\": \"2026-01-09T10:02:49.929Z\",\n                \"webhook_data\": [],\n                \"api_log\": [],\n                \"routing_rules_history\": [],\n                \"gateway_retry_attempts_history\": [],\n                \"ip_address\": [],\n                \"is_currency_conversion_applied\": false,\n                \"is_checkout_flow\": false,\n                \"amount\": 10,\n                \"billingAddress\": {\n                    \"address1\": \"DHA Phase 2\",\n                    \"city\": \"Islamabad\",\n                    \"country\": \"Pakistan\",\n                    \"province\": \"Islamabad\",\n                    \"zip\": \"44000\",\n                    \"shipping_method\": \"Standard\"\n                },\n                \"capture_method\": \"manual\",\n                \"currency\": \"PKR\",\n                \"customer\": {\n                    \"name\": \"Necibe Mirzai\",\n                    \"email\": \"necibe.mirzai@xstak.com\",\n                    \"phone\": \"905374182171\",\n                    \"vip_customer\": \"No\",\n                    \"previous_customer\": \"false\"\n                },\n                \"original_amount\": \"500\",\n                \"payment_method_types\": \"card\",\n                \"shipping\": {\n                    \"address1\": \"Model Town Block C\",\n                    \"city\": \"Karachi\",\n                    \"country\": \"Pakistan\",\n                    \"province\": \"Punjab\",\n                    \"zip\": \"75500\",\n                    \"shipping_method\": \"Standard\"\n                },\n                \"updatedAt\": \"2026-01-09T10:02:56.324Z\"\n            },\n            {\n                \"_id\": \"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5\",\n                \"account_id\": \"0ddb82950784f875\",\n                \"store_id\": \"670cc16ca4f54be748916396\",\n                \"metadata\": {\n                    \"order_reference\": \"32424ew24e234r23er\",\n                    \"check_network_blocklist\": false,\n                    \"skip_blocklist\": true,\n                    \"continue_payment\": true\n                },\n                \"pi_client_secret\": \"xpay_pi_439da7d745c851457f347d6e840abc2177d3d33febc32d3599d4d089260e8ad5_cs_912161d25e980fc4add787dc97c53e53ba409a1847ab42e63b7524ee4ba22d59\",\n                \"status\": \"succeeded\",\n                \"created_at\": \"2026-01-09T10:01:10.273Z\",\n                \"last_used\": null,\n                \"mode\": \"test\",\n                \"refund_data\": {\n                    \"refunded_amount\": 0,\n                    \"refund_obj_id\": null\n                },\n                \"__v\": 0,\n                \"createdAt\": \"2026-01-09T10:01:10.273Z\",\n                \"webhook_data\": [],\n                \"api_log\": [],\n                \"routing_rules_history\": [],\n                \"gateway_retry_attempts_history\": [],\n                \"ip_address\": [\n                    \"122.129.66.220\"\n                ],\n                \"is_currency_conversion_applied\": false,\n                \"is_checkout_flow\": false,\n                \"amount\": 500,\n                \"billingAddress\": {\n                    \"address1\": \"DHA Phase 2\",\n                    \"city\": \"Islamabad\",\n                    \"country\": \"Pakistan\",\n                    \"province\": \"Islamabad\",\n                    \"zip\": \"44000\",\n                    \"shipping_method\": \"Standard\"\n                },\n                \"capture_method\": \"manual\",\n                \"currency\": \"PKR\",\n                \"customer\": {\n                    \"name\": \"Guest User\",\n                    \"email\": \"necibe.mirzai@xstak.com\",\n                    \"phone\": \"905374182171\"\n                },\n                \"original_amount\": \"500\",\n                \"payment_method_types\": \"card\",\n                \"shipping\": {\n                    \"address1\": \"Model Town Block C\",\n                    \"city\": \"Karachi\",\n                    \"country\": \"Pakistan\",\n                    \"province\": \"Punjab\",\n                    \"zip\": \"75500\",\n                    \"shipping_method\": \"Standard\"\n                },\n                \"updatedAt\": \"2026-01-09T10:01:27.803Z\",\n                \"hashed_card_number\": \"f04b3ffd0d3baea01f39ed58b277ca740560097b4ad7476aea52f55cd086c4e0\",\n                \"card_detail\": {\n                    \"bin\": \"512345\",\n                    \"card_number\": \"512345xxxxxx2346\",\n                    \"last_four_digits\": \"2346\"\n                },\n                \"last_update\": \"2026-01-09T10:01:27.318Z\",\n                \"last_payment_response\": {\n                    \"status\": \"PAYMENT_PARTIALLY_CAPTURED\",\n                    \"error\": false,\n                    \"message\": \"The payment was completed successfully\"\n                },\n                \"mpgs_authorization_transaction_id\": \"trans-3hLJqO18Ip\",\n                \"token\": \"\",\n                \"captured_amount\": 10\n            }\n        ],\n        \"totalDocs\": 18378\n    }\n}"}],"_postman_id":"7ca898c6-e0e5-4ed3-ba63-b11738bc93a7"},{"name":"Void Authorized Transaction","id":"398f8455-84ed-41c4-a4fd-59309eadd127","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret Api Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"}],"url":"{{base_url}}/public/v1/payment/intent/void?pi_client_secret={{pi_client_secret}}","description":"<p>This API allows you to void a previously authorized payment, after which the transaction can no longer be captured.</p>\n","urlObject":{"path":["public","v1","payment","intent","void"],"host":["{{base_url}}"],"query":[{"key":"pi_client_secret","value":"{{pi_client_secret}}"}],"variable":[]}},"response":[{"id":"64fc7b00-69b9-4eda-8045-744adafa79ba","name":"Void Authorized Transaction","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"Secret Api Key"},{"key":"x-account-id","value":"{{x-account-id}}","description":"Account Id"}],"url":{"raw":"{{base_url}}/public/v1/payment/intent/void?pi_client_secret={{pi_client_secret}}","host":["{{base_url}}"],"path":["public","v1","payment","intent","void"],"query":[{"key":"pi_client_secret","value":"{{pi_client_secret}}"}]}},"status":"OK","code":200,"_postman_previewlanguage":"","header":[{"key":"Date","value":"Fri, 09 Jan 2026 12:25:41 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"2143"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"85f-nerb3rAb15MPP03/ZXXZk169tYE\""}],"cookie":[{"expires":"Invalid Date","domain":"","path":""}],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_pi_e223c68aac14f549d502021e3c3ddac0bbad2fa4836c44146ac54ebf1db83b79\",\n        \"pi_client_secret\": \"xpay_pi_e223c68aac14f549d502021e3c3ddac0bbad2fa4836c44146ac54ebf1db83b79_cs_d10a6fed383b454f3e5100757315e28956c8ab2d546214f956bd152baa3b6e56\",\n        \"created_at\": \"2026-01-09T12:18:34.569Z\",\n        \"last_update\": \"2026-01-09T12:20:05.427Z\",\n        \"amount\": 500,\n        \"currency\": \"PKR\",\n        \"refund\": {\n            \"refunded_amount\": 0,\n            \"refund_object_id\": null\n        },\n        \"object_name\": \"payment_intent\",\n        \"payment_method_types\": \"card\",\n        \"customer\": {\n            \"name\": \"Guest User\",\n            \"email\": \"necibe.mirzai@xstak.com\",\n            \"phone\": \"905374182171\"\n        },\n        \"description\": \"\",\n        \"pi_status\": \"voided\",\n        \"pm_token\": \"\",\n        \"shipping\": {\n            \"address1\": \"Model Town Block C\",\n            \"address2\": \"\",\n            \"city\": \"Karachi\",\n            \"country\": \"Pakistan\",\n            \"firstName\": \"\",\n            \"lastName\": \"\",\n            \"phone\": \"\",\n            \"province\": \"Punjab\",\n            \"zip\": \"75500\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"metadata\": {\n            \"order_reference\": \"wedfokwewwwmdowee\",\n            \"check_network_blocklist\": false,\n            \"skip_blocklist\": true,\n            \"continue_payment\": true\n        },\n        \"token\": null,\n        \"capture_method\": \"manual\",\n        \"return_url\": null,\n        \"html_response\": {\n            \"next_action\": \"\",\n            \"hidden\": false\n        },\n        \"bank_response\": {},\n        \"last_payment_response\": {\n            \"error\": false,\n            \"status\": \"PAYMENT_VOIDED\",\n            \"message\": \"Payment Voided Successfully\",\n            \"token\": \"\"\n        },\n        \"encryptionKey\": \"-----BEGIN PUBLIC KEY-----\\nMIIBIjANBgkqhkiG9w0BAQEFAAOCAQ8AMIIBCgKCAQEA2NSRRY9uKjTo/DEBw9jC\\n481/mIzhst5cpJfF93kUH0UYubBv1/mZuk7yNXmhfX2JO/ZqjDag0cO1GAAh51kZ\\ngi0bwv8DlLtDSyomu3FSHSTEG4LWqLJJcQ0aF6Rx9gST57wHw0QfbJFKFkQIYsR3\\nQX0/3F35VAu10oQInXlLHhGWxZB44IjxdBm5p64444mqZ+cJWpJVJXuniQ34x4Ai\\n0R8t3wN2J1LWFXos45cmqod3Hjjxi9ZIaHnZh/1UgIoHhdC6hwcz9H8E62SCRwNT\\nV3J2zcVGeDl+KDXpk3SJNf5SzuRM6h9MdWvG5mnekOSMyG/bx9Njkr/3YKjNJqG3\\n5QIDAQAB\\n-----END PUBLIC KEY-----\\n\",\n        \"product\": {\n            \"product_name\": \"Intercity Travel\",\n            \"product_category\": \"Transport\",\n            \"no_of_items\": \"2\",\n            \"_id\": \"6960f21af4dfb1d20a37a341\"\n        },\n        \"billingAddress\": {\n            \"address1\": \"DHA Phase 2\",\n            \"city\": \"Islamabad\",\n            \"country\": \"Pakistan\",\n            \"province\": \"Islamabad\",\n            \"zip\": \"44000\",\n            \"shipping_method\": \"Standard\"\n        },\n        \"routing_rules_history\": [],\n        \"gateway\": \"bank-alfalah\",\n        \"subscription\": {},\n        \"checkout_page_url\": null,\n        \"dqr_data\": null\n    }\n}"}],"_postman_id":"398f8455-84ed-41c4-a4fd-59309eadd127"}],"id":"37e89934-27dd-4414-aa14-69cb2a359e4c","_postman_id":"37e89934-27dd-4414-aa14-69cb2a359e4c","description":""},{"name":"Refund","item":[{"name":"Create a refund","event":[{"listen":"prerequest","script":{"id":"8e54fd6d-1221-4f72-b609-5408db3d2f27","exec":[""],"type":"text/javascript","packages":{},"requests":{}}}],"id":"75bf7d62-1c28-4388-8ae6-4bb4696c89f8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"payment_intent_id\": \"xpay_pi_ea9f31223dc3b66ca93a73d0c6594f7bdc37bbbaf3e449e4be4b0620516062a7\",\n    \"reason\": \"Customer Request\",\n    \"refunded_amount\": 500\n}"},"url":"{{base_url}}/public/v1/refund","urlObject":{"path":["public","v1","refund"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"99dfce0c-60a1-4641-b52f-c1e273877bed","name":"Create a refund","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key-sk}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"x-signature","value":"{{x-signature}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"payment_intent_id\": \"xpay_pi_ea9f31223dc3b66ca93a73d0c6594f7bdc37bbbaf3e449e4be4b0620516062a7\",\n    \"reason\": \"Customer Request\",\n    \"refunded_amount\": 500\n}"},"url":"https://xstak-pay-stg.xstak.com/public/v1/refund"},"status":"OK","code":200,"_postman_previewlanguage":null,"header":[{"key":"Date","value":"Fri, 09 Jan 2026 11:14:43 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"524"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"20c-8JwYi9lnmllKijAIy4/6MB/9V6A\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_ref_5065402c420c6f0b20a7ed50a6c13657546f33ab80055dccc017b1f7963fe012\",\n        \"payment_intent_id\": \"xpay_pi_ea9f31223dc3b66ca93a73d0c6594f7bdc37bbbaf3e449e4be4b0620516062a7\",\n        \"account_id\": \"0ddb82950784f875\",\n        \"created_at\": \"2026-01-09T11:14:42.967Z\",\n        \"last_used\": null,\n        \"object_name\": \"refund\",\n        \"refunded_amount\": 500,\n        \"currency\": \"PKR\",\n        \"reason\": \"Customer Request\",\n        \"mode\": \"test\",\n        \"status\": \"refunded\",\n        \"refund_initiator_id\": \"Refund API\",\n        \"__v\": 0\n    }\n}"}],"_postman_id":"75bf7d62-1c28-4388-8ae6-4bb4696c89f8"},{"name":"Update a refund","event":[{"listen":"prerequest","script":{"id":"246c0bbe-d962-42c5-a0aa-b969385180ab","exec":[""],"type":"text/javascript","packages":{},"requests":{}}}],"id":"9f0a71d0-d8e1-4531-9944-4e4becce666b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PUT","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"payment_intent_id\": \"xpay_pi_6adcdd2e4c615017eff318bbb3204f15bf186a523fd53bc2678bd068680bb8a2\",\n    \"refunded_amount\": 200\n}"},"url":"{{base_url}}/public/v1/refund/:refund_id","urlObject":{"path":["public","v1","refund",":refund_id"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"refund_id"}]}},"response":[{"id":"ab9d2b7b-f141-4ce6-8c63-d75039b70a89","name":"Update a refund","originalRequest":{"method":"PUT","header":[{"key":"x-api-key","value":"{{x-api-key-sk}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"x-signature","value":"{{x-signature}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"payment_intent_id\": \"xpay_pi_6adcdd2e4c615017eff318bbb3204f15bf186a523fd53bc2678bd068680bb8a2\",\n    \"refunded_amount\": 200\n}"},"url":{"raw":"https://xstak-pay-stg.xstak.com/public/v1/refund/:refund_id","protocol":"https","host":["xstak-pay-stg","xstak","com"],"path":["public","v1","refund",":refund_id"],"variable":[{"key":"refund_id","value":"xpay_ref_07dd3df22897684a931f1a7323194f0ca57cd5a1649fe6730fc8dd7da4424bfb"}]}},"status":"OK","code":200,"_postman_previewlanguage":null,"header":[{"key":"Date","value":"Fri, 09 Jan 2026 11:18:07 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"534"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"216-5fD0YIAS/96uktUuMUB0eTq41j4\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_ref_07dd3df22897684a931f1a7323194f0ca57cd5a1649fe6730fc8dd7da4424bfb\",\n        \"payment_intent_id\": \"xpay_pi_6adcdd2e4c615017eff318bbb3204f15bf186a523fd53bc2678bd068680bb8a2\",\n        \"account_id\": \"0ddb82950784f875\",\n        \"created_at\": \"2026-01-09T11:16:54.411Z\",\n        \"last_used\": null,\n        \"object_name\": \"refund\",\n        \"refunded_amount\": 300,\n        \"currency\": \"PKR\",\n        \"reason\": \"Customer Request\",\n        \"mode\": \"test\",\n        \"status\": \"partially_refunded\",\n        \"refund_initiator_id\": \"Refund API\",\n        \"__v\": 0\n    }\n}"}],"_postman_id":"9f0a71d0-d8e1-4531-9944-4e4becce666b"},{"name":"Retrieve a refund","id":"1b37bed1-442e-41ea-a68b-8224f50ef73b","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret API Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"}],"url":"{{base_url}}/public/v1/refund/:refund_id","urlObject":{"path":["public","v1","refund",":refund_id"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"refund_id"}]}},"response":[{"id":"6aea3219-240c-4539-9ff8-67fcce6dfb96","name":"Retrieve a refund","originalRequest":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key-sk}}"},{"key":"x-account-id","value":"{{x-account-id}}"}],"url":{"raw":"https://xstak-pay-stg.xstak.com/public/v1/refund/:refund_id","protocol":"https","host":["xstak-pay-stg","xstak","com"],"path":["public","v1","refund",":refund_id"],"variable":[{"key":"refund_id","value":"xpay_ref_07dd3df22897684a931f1a7323194f0ca57cd5a1649fe6730fc8dd7da4424bfb"}]}},"status":"OK","code":200,"_postman_previewlanguage":null,"header":[{"key":"Date","value":"Fri, 09 Jan 2026 11:18:58 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"534"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"Vary","value":"Origin"},{"key":"Access-Control-Allow-Credentials","value":"true"},{"key":"Content-Security-Policy","value":"default-src 'self'; script-src 'self'; style-src 'self' https://fonts.googleapis.com; font-src 'self' https://fonts.gstatic.com data:; img-src 'self' https://js.xstak.com data:; require-trusted-types-for 'script';"},{"key":"Strict-Transport-Security","value":"max-age=31536000; includeSubDomains"},{"key":"ETag","value":"W/\"216-5fD0YIAS/96uktUuMUB0eTq41j4\""}],"cookie":[],"responseTime":null,"body":"{\n    \"success\": true,\n    \"responseStatus\": \"OK\",\n    \"message\": \"Request processed successfully.\",\n    \"data\": {\n        \"_id\": \"xpay_ref_07dd3df22897684a931f1a7323194f0ca57cd5a1649fe6730fc8dd7da4424bfb\",\n        \"payment_intent_id\": \"xpay_pi_6adcdd2e4c615017eff318bbb3204f15bf186a523fd53bc2678bd068680bb8a2\",\n        \"account_id\": \"0ddb82950784f875\",\n        \"created_at\": \"2026-01-09T11:16:54.411Z\",\n        \"last_used\": null,\n        \"object_name\": \"refund\",\n        \"refunded_amount\": 300,\n        \"currency\": \"PKR\",\n        \"reason\": \"Customer Request\",\n        \"mode\": \"test\",\n        \"status\": \"partially_refunded\",\n        \"refund_initiator_id\": \"Refund API\",\n        \"__v\": 0\n    }\n}"}],"_postman_id":"1b37bed1-442e-41ea-a68b-8224f50ef73b"}],"id":"7a7911e5-3dd2-42a7-a163-f335e3909054","_postman_id":"7a7911e5-3dd2-42a7-a163-f335e3909054","description":""},{"name":"Tokenization","item":[{"name":"Pay with merchant Token","id":"3da0ef0a-e270-4f61-a632-63ca43a686d3","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret Api Key</p>\n","type":"text"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n","type":"text"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\n\t\"amount\": 10,\n\t\"currency\": \"PKR\",\n\t\"payment_method_types\": \"token\",\n\t\"customer\": {\n    \t\"name\": \"Guest User\",\n    \t\"email\": \"guest@gmail.com\",\n    \t\"phone\":\"03415555555\"\n\t},\n\t\"shipping\": {\n    \t\"address1\": \"abc\",\n    \t\"city\": \"Islamabad\",\n    \t\"country\": \"Pakistan\",\n    \t\"phone\": \"03415555555\",\n    \t\"zip\": \"12345\",\n    \t\"shipping_method\": \"Standard\"\n\t},\n\t\"metadata\": {\n    \t\"order_reference\": \"XX-Order-1\"\n\t},\n\t\"token\":\"xpay_token_a5d1e0ef0d23082992a\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v2/payment/intent/tokenized/payment","urlObject":{"path":["public","v2","payment","intent","tokenized","payment"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3da0ef0a-e270-4f61-a632-63ca43a686d3"},{"name":"Fetch Token Details","id":"d249bc20-8153-4d7c-9b7f-53a0c9c2b539","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret APi Key</p>\n","type":"text"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n","type":"text"}],"url":"{{base_url}}/public/v1/token/:token","urlObject":{"path":["public","v1","token",":token"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"token"}]}},"response":[],"_postman_id":"d249bc20-8153-4d7c-9b7f-53a0c9c2b539"},{"name":"Delete a token","id":"d87589af-d237-4a10-a432-80430dfb2bd1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret APi Key</p>\n","type":"text"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n","type":"text"}],"url":"{{base_url}}/public/v1/token/:token","urlObject":{"path":["public","v1","token",":token"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"token"}]}},"response":[],"_postman_id":"d87589af-d237-4a10-a432-80430dfb2bd1"},{"name":"Get all saved tokens / payment methods","id":"11a40d79-39fd-42fd-95c3-6156f46f5a5e","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret Api Key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account ID</p>\n"}],"url":"{{base_url}}/public/v1/token","description":"<p>This API can be used to get all saved tokens and saved payment methods. To use this API starting from June 26, 2024, you will need to create new tokens by adding <code>reason: \"token\"</code> in the <code>Create PI API</code> payload metadata.</p>\n<p>Support will be provided later for live tokens on-demand.</p>\n","urlObject":{"path":["public","v1","token"],"host":["{{base_url}}"],"query":[{"disabled":true,"description":{"content":"<p>Get active tokens only</p>\n","type":"text/plain"},"key":"enabled","value":"true"},{"disabled":true,"description":{"content":"<p>Fetch using email</p>\n","type":"text/plain"},"key":"email","value":""},{"disabled":true,"description":{"content":"<p>Fetch using phone</p>\n","type":"text/plain"},"key":"phone","value":""}],"variable":[]}},"response":[],"_postman_id":"11a40d79-39fd-42fd-95c3-6156f46f5a5e"}],"id":"b6229270-ed71-4221-950f-0da40d073efb","description":"<p><strong>Token Creation</strong></p>\n<ol>\n<li><p>Create a payment intent by passing a specific key-value in metadata.</p>\n<ol>\n<li>“reason”: “token”</li>\n</ol>\n</li>\n<li><p>Confirm Payment SDK will work as usual.</p>\n</li>\n<li><p>The token will be returned in the webhook with details.</p>\n</li>\n</ol>\n<p><strong>Tokenized Payment</strong></p>\n<ol>\n<li>A single backend API call will be used to create a PI and confirm payment with the token.</li>\n</ol>\n<h1 id=\"token-creation\">Token Creation</h1>\n<ol>\n<li>Create a Payment Intent</li>\n</ol>\n<p>Create a Payment Intent object with all the required fields and pass the reason in the metadata field with a value token, which will indicate that this Payment Intent object will create a merchant token.</p>\n<p><strong>Create PI Request body change</strong></p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">metadata: {\n\"reason\": \"token\"\n}\n\n</code></pre>\n<p>2. Confirm Payment Intent with Card Details</p>\n<ol>\n<li><p>No changes are required in this API</p>\n</li>\n<li><p>If the Transaction is Successfully Captured, the created TOKEN will be returned via webhook.</p>\n</li>\n</ol>\n<h1 id=\"token-limit\">Token Limit</h1>\n<ol>\n<li><p>The maximum limit of tokens against each user (email/phone number) is 5.</p>\n</li>\n<li><p>If the token limit is reached, to continue normal payments without saving tokens, the following key-value pair can be added in Create PI API. Otherwise, the payments will be declined.</p>\n</li>\n</ol>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-json\">metadata: {\n\"continue_payment\": true\n}\n\n</code></pre>\n","_postman_id":"b6229270-ed71-4221-950f-0da40d073efb"},{"name":"BIN","item":[{"name":"Fetch BIN details via BIN Number","id":"0b96c3f8-6a94-488a-8f08-3470a15e5681","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret Api key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"}],"url":"{{base_url}}/public/v1/bin/config/:bin","urlObject":{"path":["public","v1","bin","config",":bin"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"bin"}]}},"response":[],"_postman_id":"0b96c3f8-6a94-488a-8f08-3470a15e5681"},{"name":"Fetch BIN details via custom ID","id":"6ebf7ea5-8917-4eb8-b87c-89d4d1442e53","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"auth":{"type":"noauth","isInherited":false},"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret Api key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"}],"url":"{{base_url}}/public/v1/bin/config/id/:id","urlObject":{"path":["public","v1","bin","config","id",":id"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"id"}]}},"response":[],"_postman_id":"6ebf7ea5-8917-4eb8-b87c-89d4d1442e53"}],"id":"072461a4-90c3-4fd5-b317-a713d9787ce0","_postman_id":"072461a4-90c3-4fd5-b317-a713d9787ce0","description":""}],"id":"3cd732c7-6a5d-4a99-924d-83a3c6e74bda","description":"<h1 id=\"xpay-fusion\">XPay Fusion</h1>\n<p>XPay Fusion is a PCI DSS-compliant payment solution to collect payments from your customers on your webapp without them having to redirect to a third-party payment page.</p>\n<h1 id=\"integrating-xpay-fusion\">Integrating XPay Fusion</h1>\n<img src=\"https://content.pstmn.io/bcc2bec9-cb59-4544-9817-bdd96ebe3959/aW1hZ2UxLnBuZw==\" alt=\"XPay%20e2e%20Integration%20-%20Sequence%20Diagram\" />\n\n<p>To integrate XPay Fusion with your eCommerce store, you need to:</p>\n<ol>\n<li><p>Integrate Fusion APIs on the server side and</p>\n</li>\n<li><p>Add the Fusion embedded element on the client side by using XPay JS SDK.</p>\n</li>\n</ol>\n<h1 id=\"step-by-step-flow\"><strong>Step by step flow</strong></h1>\n<ol>\n<li><p>When your customer comes to the checkout page, they enter their card details into the card details form rendered in a secure iframe, enabled by the Fusion Embedded Element. They then click the Place Order button.</p>\n</li>\n<li><p>The Fusion Embedded Element can be added to your frontend project as follows:</p>\n</li>\n</ol>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-bash\">npm i @xstak/xpay-element-stage-v4\n\n</code></pre>\n<p>3. Import the XPay provider and add the required keys</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">import { XPay } from '@xstak/xpay-element-stage-v4';\nfunction XPayPayment() {\nreturn  (\n&lt;XPay xpay={{ publishableKey: \"\", accountId: \"\", hmacSecret: \"\"}}&gt;\n&lt;Payment /&gt;\n&lt;/XPay&gt;\n)}\n\n</code></pre>\n<p>4. Render the Fusion Embedded Element</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">import React, { useState } from 'react';\nimport { PaymentElement, useXpay } from '@xstak/xpay-element-stage-v4';\nexport const Payment = () =&gt; {\n    const options = {\n        override: true,\n        fields: {\n          creditCard: {\n            placeholder: \"4234 1234 1234 1234\",\n            label: \"Enter your credit card\",\n          },\n          exp: {\n            placeholder: \"Exp. Date\",\n          },\n        },\n        style: {\n          \".input\": {\n            \"border\": \"1px solid black\",\n            \"border-radius\": \"15px\"\n           },\n          \".invalid\": {},\n          \".label\": {\n            \"font-size\": \"18px\"\n           },\n          \":focus\": {},\n          \":hover\": {},\n          \"::placeholder\": {},\n          \"::selection\": {},\n        },\n      };\n    const xpay = useXpay();\n    const pay = async() =&gt; { \nconst { message, error } = await xpay.confirmPayment(\"card\", payment_intent_client_secret,{name: 'Dane Joe'}, encryptionKey);\n//if payment is successful, request backend to create order.\n//else if payment is unsuccessful, show error message\n    }\n    return(\n        &lt;&gt;\n        &lt;PaymentElement options={options} onReady={(event) =&gt; {\n            console.log(\"ready event\", event);\n          }} /&gt;\n        &lt;Button type=\"primary\" onClick={pay}&gt;\n          Pay Now\n        &lt;/Button&gt;\n    )\n}\n\n</code></pre>\n<p><strong>Important:</strong> XPay SDK supports custom styling and changing labels and placeholder texts of input fields as per your design to provide a seamless experience to your customers.</p>\n<p>5. When the customer clicks on the Place Order button, the frontend requests the backend to start the payment processing by passing relevant details about the cart (cart id, cart total etc) and the customer (customer name and contact details etc). Since the order would not have been created as yet, it is recommended that the cart id be used at this step.</p>\n<p>6. The backend receives this request from the frontend and creates a payment intent by calling the <strong>Create Payment Intent API</strong> and returns the response to the frontend:</p>\n<p>a. The cart id should be added in the metadata object, with the key of order_reference, of Create Payment Intent call payload to reference it later. However, any other key/value can also be added in the metadata object.</p>\n<p>b. Important: Payment Intent id is the single source of truth in XPay Fusion and it will be used as a reference for the payment and any possible future actions such as refund, etc.</p>\n<p>c. Payment intent client secret and encryptionKey are included in the response of the Create Payment Intent call. This client secret and encryptionKey will be needed to capture the payment and pass in confirmPayment SDK method as shown below.</p>\n<p>7. Once the frontend receives the payment intent from the backend, it will call the confirmPayment method of the XPay JS SDK and pass it the payment intent client secret.</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">const { message, error } = await xpay.confirmPayment(\"card\", payment_intent_client_secret,{name: 'Dane Joe'}, encryptionKey);\n\n</code></pre>\n<p>8. This confirmPayment SDK method will return a promise which will be resolved with a response object citing either success or failure message with the reason.</p>\n<p>a. If successful, the frontend can request the backend to create the order. It is recommended that the backend retrieve the payment intent from XPay by calling the Retrieve Payment Intent API, verify the payment information and then create the order and inform the frontend.</p>\n<p>b. If unsuccessful, the frontend should show an error message to the customer.</p>\n<p>c. You can also set up webhooks to get notified of payment status asynchronously.</p>\n<h2 id=\"form-validation-error-handling\">Form Validation Error Handling</h2>\n<p>We have an event named ready which will return true if all fields have been filled by user and form is ready to be submitted.</p>\n<p>It will ensure that the website only enables the payment button if all required data has been added to the iframe form.</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\"> // React\n&lt;PaymentElement options={options} onReady={(event) =&gt; {\n    console.log(\"ready event\", event);\n }} /&gt;\n// Veniala Js\nxpay.on(\"ready\", function (event) {\n  console.log(event, \"onready\");\n});\n\n</code></pre>\n<h3 id=\"hmac-authentication\">HMAC Authentication</h3>\n<p>To use API, you must authenticate your requests with HMAC. For HMAC authentication please use the SHA256 algorithm. You will need to generate an HMAC signature using HMAC shared secret API key and request payload by passing it in JSON.stringify() format.</p>\n<p>The signature should be added to the request headers as follows:</p>\n<p><strong>Common Header Parameters:</strong></p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Header</strong></th>\n<th><strong>Value</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>x-api-key</td>\n<td>{API Key}</td>\n</tr>\n<tr>\n<td>x-account-id</td>\n<td>{Account ID}</td>\n</tr>\n<tr>\n<td>x-signature</td>\n<td>{HMAC Signature}</td>\n</tr>\n</tbody>\n</table>\n</div><p>To generate the HMAC signature, you should use API Signature key and JSON stringify request body payload that is described below:</p>\n<p><strong>How to generate signatures using Python</strong></p>\n<p>This python code will generate a HMAC signature:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-python\">import requests\nimport hmac\nimport hashlib\nimport json\nsecret_key = 'API Signature key'\ndata = {\n   \"order\": {\n       \"id\": \"testOrder-001\",\n       \"currency\": \"PKR\",\n       \"order_amount\": 20\n   },\n   \"customer\": {\n       \"name\": \"John\",\n       \"email\": \"john@gmail.com\",\n       \"phone\": \"12345678990\"\n   },\n   \"metadata\": {\n       \"key\": \"value\"\n   },\n   \"description\": \"any description\"\n}\nmessage = json.dumps(data, separators=(',', ':'))\nsignature = hmac.new(secret_key, message, hashlib.sha256).hexdigest()\n\n</code></pre>\n<h3 id=\"how-to-generate-signatures-using-php\"><strong>How to generate signatures using PHP</strong></h3>\n<p>PHP code to generate a HMAC signature:</p>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-php\">$payload = array(\n  \"order\" =&gt; array(\n    \"id\" =&gt; \"testOrder-999\",\n    \"currency\" =&gt; \"PKR\",\n    \"order_amount\" =&gt; 20,\n  ),\n  \"customer\" =&gt; array(\n    \"name\" =&gt; \"John\",\n    \"email\" =&gt; \"john@gmail.com\",\n    \"phone\" =&gt; \"12345678990\",\n  ),\n  \"metadata\" =&gt; array(\n    \"key\" =&gt; \"value\",\n  ),\n  \"description\" =&gt; \"any description\",\n);\n$data = json_encode($payload);\n$hmac_sc_api = 'API Signature key';\n$hash = hash_hmac('sha256', $data, $hmac_sc_api);\necho $hash;\n?&gt;\n\n</code></pre>\n<h3 id=\"how-to-generate-signature-in-node\"><strong>How to generate signature in Node</strong></h3>\n<p>To add HMAC signature to a REST API request in Express you can follow these steps:</p>\n<ol>\n<li><p>Install the crypto-js package which provides the HMAC algorithm implementation for Node.js: npm install crypto-js</p>\n</li>\n<li><p>Create a function that will be used to generate the HMAC signature for the request. This function should accept the HTTP method, request URL, request body, and the secret key as arguments.</p>\n</li>\n</ol>\n<pre class=\"click-to-expand-wrapper is-snippet-wrapper\"><code class=\"language-javascript\">const crypto = require('crypto');\nconst body = {\n    \"order\": {\n        \"id\": \"testOrder-999\",\n        \"currency\": \"PKR\",\n        \"order_amount\": 20\n    },\n    \"customer\": {\n        \"name\": \"John\",\n        \"email\": \"john@gmail.com\",\n        \"phone\": \"12345678990\"\n    },\n    \"metadata\": {\n        \"key\": \"value\"\n    },\n    \"description\": \"any description\"\n}\n    const data = JSON.stringify(body);\n    const secretKey = 'API Signature key';\n    const signature = crypto.createHmac('SHA256', secretKey).update(data).digest('hex');\n    return signature;\n\n</code></pre>\n","_postman_id":"3cd732c7-6a5d-4a99-924d-83a3c6e74bda"},{"name":"Payment Links","item":[{"name":"Custom Payment Link","id":"334f02f0-3c23-404a-a587-ba5d1e869711","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"<p>Secret Api key</p>\n"},{"key":"x-account-id","value":"{{x-account-id}}","description":"<p>Account Id</p>\n"},{"key":"x-signature","value":"{{x-signature}}","description":"<p>Generate body payload hash using the API signature key</p>\n"}],"body":{"mode":"raw","raw":"{\n    \"order\": {\n        \"id\": \"testOrder-007\",\n        \"currency\": \"PKR\",\n        \"order_amount\": 20\n    },\n    \"customer\": {\n        \"name\": \"John\",\n        \"email\": \"john@gmail.com\",\n        \"phone\": \"12345678990\"\n    },\n    \"metadata\": {\n        \"key\": \"value\"\n    },\n    \"description\": \"any description\"\n}"},"url":"{{base_url}}/public/v1/payment/link","urlObject":{"path":["public","v1","payment","link"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[{"id":"34fcb8d4-69b1-464b-add1-a58ce603c21a","name":"Succes response","originalRequest":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","description":"Secret Api Key"},{"key":"x-account-id","value":"{{x-account-id}}","description":"Account Id"},{"key":"x-signature","value":"{{x-signature}}","description":"Generate body payload hash using the API signature key"}],"body":{"mode":"raw","raw":"{\n    \"order\": {\n        \"id\": \"testOrder-000\",\n        \"currency\": \"PKR\",\n        \"order_amount\": 20\n    },\n    \"customer\": {\n        \"name\": \"John\",\n        \"email\": \"john@gmail.com\",\n        \"phone\": \"12345678990\"\n    },\n    \"metadata\": {\n        \"key\": \"value\"\n    },\n    \"description\": \"any description\"\n}"},"url":"{{base_url}}/public/v1/payment/link"},"status":"OK","code":200,"_postman_previewlanguage":"json","header":[{"key":"Date","value":"Wed, 22 Mar 2023 07:46:25 GMT"},{"key":"Content-Type","value":"application/json; charset=utf-8"},{"key":"Content-Length","value":"300"},{"key":"Connection","value":"keep-alive"},{"key":"X-Powered-By","value":"Express"},{"key":"Access-Control-Allow-Origin","value":"*"},{"key":"ETag","value":"W/\"12c-440udH3My+Xgt8xk55d462UTHZk\""}],"cookie":[],"responseTime":null,"body":"{\n    \"status\": \"success\",\n    \"message\": \"Payment link created successfully\",\n    \"payment_link\": \"dev.xta.ac/66ac09\",\n    \"order\": {\n        \"id\": \"testOrder-000\",\n        \"currency\": \"PKR\",\n        \"order_amount\": 20\n    },\n    \"customer\": {\n        \"name\": \"John\",\n        \"email\": \"john@gmail.com\",\n        \"phone\": \"12345678990\"\n    },\n    \"metadata\": {\n        \"key\": \"value\"\n    },\n    \"description\": \"any description\"\n}"}],"_postman_id":"334f02f0-3c23-404a-a587-ba5d1e869711"}],"id":"e2279371-76d3-4f8f-aba5-95d8ed7956e8","description":"<p>The API is used to generate a shortened payment link that can be shared with customers. This link will redirect the customer to the secure payment page where they can complete the payment process.</p>\n<ul>\n<li><strong>Request Parameters:</strong></li>\n</ul>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Type</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>order</td>\n<td>object</td>\n<td>An object containing information about the  <br />order details.</td>\n</tr>\n<tr>\n<td>customer</td>\n<td>object</td>\n<td>An object containing information about the  <br />customer.</td>\n</tr>\n<tr>\n<td>metadata</td>\n<td>object</td>\n<td>Any information related to the request (optional).</td>\n</tr>\n<tr>\n<td>description</td>\n<td>string</td>\n<td>Any description of the request (optional).</td>\n</tr>\n</tbody>\n</table>\n</div><p>The <strong>customer object</strong> should contain the following parameters:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Type</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>name</td>\n<td>string</td>\n<td>The name of the customer.</td>\n</tr>\n<tr>\n<td>phone</td>\n<td>string</td>\n<td>The phone number of the customer.</td>\n</tr>\n<tr>\n<td>email</td>\n<td>string</td>\n<td>The email address of the customer.</td>\n</tr>\n</tbody>\n</table>\n</div><p>The Customer object requires a name, as well as either an email or phone number.</p>\n<p>The <strong>Order object</strong> should contain the following parameters:</p>\n<div class=\"click-to-expand-wrapper is-table-wrapper\"><table>\n<thead>\n<tr>\n<th><strong>Parameter</strong></th>\n<th><strong>Type</strong></th>\n<th><strong>Description</strong></th>\n</tr>\n</thead>\n<tbody>\n<tr>\n<td>id</td>\n<td>string</td>\n<td>The unique order id for payment.</td>\n</tr>\n<tr>\n<td>currency</td>\n<td>string</td>\n<td>The currency code for the payment.</td>\n</tr>\n<tr>\n<td>order_amount</td>\n<td>number</td>\n<td>The total amount to be charged in the  <br />specified currency.</td>\n</tr>\n</tbody>\n</table>\n</div><h2 id=\"sequence-diagram-\">Sequence Diagram :</h2>\n<img src=\"https://content.pstmn.io/a6be83d6-b65e-45f3-9120-c55a65c85bf4/V2hhdHNBcHAgSW1hZ2UgMjAyMy0wMy0yMiBhdCA1LjExLjAyIFBNLmpwZWc=\" width=\"1224\" height=\"827\" />","_postman_id":"e2279371-76d3-4f8f-aba5-95d8ed7956e8"},{"name":"Subscriptions","item":[{"name":"Products","item":[{"name":"Create a product","id":"aaf968b4-3f78-4278-9788-593dea9f42a7","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"mobile-11\",\n    \"active\": true,\n    \"price\": 100,\n    \"currency\": \"PKR\",\n    \"description\": \"abcd\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/product","urlObject":{"path":["public","v1","product"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"aaf968b4-3f78-4278-9788-593dea9f42a7"},{"name":"Update a product","id":"8e02e391-8fa5-4def-b220-4df3f3f7c611","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"name\": \"\",\n    \"active\": true,\n    \"currency\": \"PKR\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/product/xpay_product_668e38c8d9c84f6ea215f8e2ef6d00aa","urlObject":{"path":["public","v1","product","xpay_product_668e38c8d9c84f6ea215f8e2ef6d00aa"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8e02e391-8fa5-4def-b220-4df3f3f7c611"},{"name":"Get a product","id":"b204100d-d595-450a-8ee7-2d2be8d9a5db","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/product/xpay_product_3a2d6d45abbb4239bcced81713cb8b7","urlObject":{"path":["public","v1","product","xpay_product_3a2d6d45abbb4239bcced81713cb8b7"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"b204100d-d595-450a-8ee7-2d2be8d9a5db"},{"name":"Get all plans against a product","id":"62c8c06b-9b1a-4b1e-b7ef-78410a5aade8","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/product/:prouct_id/plans","urlObject":{"path":["public","v1","product",":prouct_id","plans"],"host":["{{base_url}}"],"query":[],"variable":[{"type":"any","value":"","key":"prouct_id"}]}},"response":[],"_postman_id":"62c8c06b-9b1a-4b1e-b7ef-78410a5aade8"},{"name":"Get all products","id":"e3ed2583-b2b0-45ba-9e61-b42c18a39f4f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"},{"key":"Authorization","value":"Bearer eyJhbGciOiJSUzI1NiIsInR5cCIgOiAiSldUIiwia2lkIiA6ICI4VzRMRjJabTJZZW00cmVMSDZ4bjgwMEoxdDFqQS1wdm5kRzlVM281Y3BZIn0.eyJleHAiOjE3MTc1NDEwNzEsImlhdCI6MTcxNzUwNTA3MSwianRpIjoiMmM4ZWYxZTgtNzNiYi00MjdiLTlmMmYtNjg2MTA5YzYxZTUwIiwiaXNzIjoiaHR0cHM6Ly9rZXljbG9hay1kZXYtbG9jYWwueHN0YWsuY29tL2F1dGgvcmVhbG1zLzNiNmMxNWQ5NWQyNTVmMDgiLCJhdWQiOiJhY2NvdW50Iiwic3ViIjoiZTFjY2FmY2QtM2UxYi00NDBlLWI3YmQtY2QwZmMxZTg1NDUxIiwidHlwIjoiQmVhcmVyIiwiYXpwIjoiY29waWxvdCIsInNlc3Npb25fc3RhdGUiOiIzNzExNjdhMS04NzlhLTQ5YzQtODNiNC0wMWFlMzlkNjYyYzQiLCJhY3IiOiIxIiwicmVhbG1fYWNjZXNzIjp7InJvbGVzIjpbInhwYXlfc3VwZXJfYWRtaW4iLCJkZWZhdWx0LXJvbGVzLWY4ZTU1ZTcyZDcwMTdkZjIiLCJvZmZsaW5lX2FjY2VzcyIsInhwYXkiLCJ1bWFfYXV0aG9yaXphdGlvbiIsInhzdGFrLWNvcGlsb3QtYWRtaW4iXX0sInJlc291cmNlX2FjY2VzcyI6eyJjb3BpbG90Ijp7InJvbGVzIjpbInZpZXdfZGFzaGJvYXJkIiwidmlld191c2VycyIsImVkaXRfdXNlcnMiLCJhZGRfdXNlcnMiXX0sImFjY291bnQiOnsicm9sZXMiOlsibWFuYWdlLWFjY291bnQiLCJtYW5hZ2UtYWNjb3VudC1saW5rcyIsInZpZXctcHJvZmlsZSJdfX0sInNjb3BlIjoicHJvZmlsZSBlbWFpbCIsInNpZCI6IjM3MTE2N2ExLTg3OWEtNDljNC04M2I0LTAxYWUzOWQ2NjJjNCIsImVtYWlsX3ZlcmlmaWVkIjpmYWxzZSwibmFtZSI6IkFsaSBSYXphIiwicHJlZmVycmVkX3VzZXJuYW1lIjoiYWxpQHhzdGFrLmNvbSIsImdpdmVuX25hbWUiOiJBbGkiLCJmYW1pbHlfbmFtZSI6IlJhemEiLCJlbWFpbCI6ImFsaUB4c3Rhay5jb20ifQ.BVJiw3y6ABxGz86gcKwgE9c976mdoLSeiGgaIX43d2-dOnvizMFzdgNPC9aU7_Z_zHEUbT98Z8g7rF8Mvb3S8jOxAoKZAlyXivopdk8h1bOI3N-NoL4iA7O4vbDHOSOuSZDeJ8vmTChcxpuEasaVLRrsCYIYK-bc_G1GOzZ1_R-cRE8HOIABg2qc0A9y9gGzPdQ1FqWu0dW9zXdLX4JDrdNAc8UQ7ekc6YvfpYJTMQ-gBrIF_eOFi_sSvAR1B3d2hknWGJzEFdUEr-AAv6DiLAb3ODanZNLFFP24eXc_ydanlcColD2sOTfZ9ci6lDaiNX2a2X_4j3F-nq7v-I70hw"}],"url":"{{base_url}}/public/v1/product","urlObject":{"path":["public","v1","product"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e3ed2583-b2b0-45ba-9e61-b42c18a39f4f"},{"name":"Delete a product","id":"cd5577c5-15a8-4bf8-b5c1-a674235ae36f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/product/xpay_product_51cfb9285ca4442e9137ec2312e070bbm","urlObject":{"path":["public","v1","product","xpay_product_51cfb9285ca4442e9137ec2312e070bbm"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"cd5577c5-15a8-4bf8-b5c1-a674235ae36f"}],"id":"9528ad33-e3c6-453f-9f61-a1f314baa952","_postman_id":"9528ad33-e3c6-453f-9f61-a1f314baa952","description":""},{"name":"Plans","item":[{"name":"Update a plan","id":"75f0c9af-5bad-46a3-9d69-a1387c86ed1f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"active\": true\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/plan/xpay_plan_fa8c11aab8d54f2e94456823dce49a82","urlObject":{"path":["public","v1","plan","xpay_plan_fa8c11aab8d54f2e94456823dce49a82"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"75f0c9af-5bad-46a3-9d69-a1387c86ed1f"},{"name":"Create a plan","id":"8890e913-196b-44cc-8d8c-939da0c154d5","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"active\": true,\n  \"interval\": \"minute\",\n  \"every\": 3,\n  \"billing_cycle\": \"per_unit/user\",\n  \"product\": [\n    \"xpay_product_6a1012ceeb324e9fb9324132aa58e4d6\"\n  ],\n  \"amount\": 10, //optional\n  \"currency\": \"PKR\", //optional\n  \"billing_cycle_anchor_config\": {\n        \"day_of_month\": \"7\" // possible values are [\"day_of_week\", \"day_of_month\", \"month\", \"day_of_month\"] day_of_month will be passed if month is being passed.\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/plan","description":"<p>Amount and currency can be added explicitly to override the price of products.</p>\n","urlObject":{"path":["public","v1","plan"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8890e913-196b-44cc-8d8c-939da0c154d5"},{"name":"Delete a plan","id":"3c73adfd-4008-4f98-93df-111528b99018","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"DELETE","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/plan/xpay_plan_1d36ea0b8c1f4b0a83a624de153e94c0","urlObject":{"path":["public","v1","plan","xpay_plan_1d36ea0b8c1f4b0a83a624de153e94c0"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3c73adfd-4008-4f98-93df-111528b99018"},{"name":"Get a plan","id":"a61f32ba-05f9-4834-bc21-da602339e7d1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/plan/xpay_plan_2937a89c90724c779b8acd219961d3c2","urlObject":{"path":["public","v1","plan","xpay_plan_2937a89c90724c779b8acd219961d3c2"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"a61f32ba-05f9-4834-bc21-da602339e7d1"},{"name":"Get all plans","id":"7d1e1ff3-e40b-41fc-9435-9c9159e4dbf6","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/plan","urlObject":{"path":["public","v1","plan"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"7d1e1ff3-e40b-41fc-9435-9c9159e4dbf6"}],"id":"5acdb842-e210-4cbd-9c6e-f3f9bb38cd69","_postman_id":"5acdb842-e210-4cbd-9c6e-f3f9bb38cd69","description":""},{"name":"Subscriptions","item":[{"name":"Create a subscription","id":"8e47bf3a-90ac-4c66-8955-781a637990df","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"plan_id\": \"\",\n  \"start_date\": \"2024-07-16T11:39:00Z\",\n  \"payment\": {\n    \"token\": \"\",\n    \"amount\": 100, // optional field\n    \"currency\": \"\" // optional field\n  },\n  \"timezone\": \"Asia/Karachi\",\n  \"collect_advance\": true, //boolean\n  \"failure_action\": \"\", //'CONTINUE' | 'CANCEL';\n  \"payment_retries_timing\": [ // optional but if added should be equal to number of retries\n    {\n      \"date\": 0,\n      \"hour\": 0,\n      \"minute\": 3\n    }\n   \n  ],\n  \"product\": [\n        {\n            \"product_id\": \"\",\n            \"quantity\": 2\n        }\n    ]\n\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription","urlObject":{"path":["public","v1","subscription"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8e47bf3a-90ac-4c66-8955-781a637990df"},{"name":"Skip a subscription","id":"e56fe1cd-f435-412e-bafe-1c0ea7bd6b28","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"type\": \"invoice_id\",\n    \"invoice_id\": \"xpay_invoice_bfb7bf8b09a54850b273e5333abdb58a\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription/xpay_subs_af8fae336b12448593ce63c45b4989eb/skip","urlObject":{"path":["public","v1","subscription","xpay_subs_af8fae336b12448593ce63c45b4989eb","skip"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"e56fe1cd-f435-412e-bafe-1c0ea7bd6b28"},{"name":"unskip a subscription","id":"591ba7a9-8685-4cc6-95a1-80915cf3f035","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"type\": \"invoice_id\",\n    \"invoice_id\": \"xpay_invoice_bfb7bf8b09a54850b273e5333abdb58a\",\n    \"override\": true\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription/xpay_subs_af8fae336b12448593ce63c45b4989eb/unskip","urlObject":{"path":["public","v1","subscription","xpay_subs_af8fae336b12448593ce63c45b4989eb","unskip"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"591ba7a9-8685-4cc6-95a1-80915cf3f035"},{"name":"cancel a subscription","id":"8f84c467-d763-4af1-919d-58b444c06b84","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"end_of_invoice\": true //optional field to cancel subscription at the end of current billing cycle. XPay will trigger a webhook when a subscription gets cancelled.\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription/xpay_subs_97fbb0eaefe54f5ebb980fa7b8a96ba5/cancel","description":"<p><code>\"end_of_invoice\": true</code></p>\n<p>It is an optional field to cancel a subscription at the end of the current billing cycle. XPay will trigger a webhook when a subscription gets canceled.</p>\n","urlObject":{"path":["public","v1","subscription","xpay_subs_97fbb0eaefe54f5ebb980fa7b8a96ba5","cancel"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"8f84c467-d763-4af1-919d-58b444c06b84"},{"name":"resume a subscription","id":"0c7fbc23-4451-413e-ae30-0b0c3dcced8f","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"billing_cycle\": \"\" // [\"retain\", \"now\"]\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription/xpay_subs_ebe492d05af544eaa1cd099a9b59e457/resume","description":"<p>If you want to keep the same billing cycle while resuming your subscription, you can add value <code>retain</code> and if you want to start from the time it is being resumed, pass <code>now</code>.</p>\n<p><code>retain</code>: same billing cycle</p>\n<p><code>now</code>: new billing cycle</p>\n","urlObject":{"path":["public","v1","subscription","xpay_subs_ebe492d05af544eaa1cd099a9b59e457","resume"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0c7fbc23-4451-413e-ae30-0b0c3dcced8f"},{"name":"pause a subscription","id":"c1bf86c5-c703-4e51-94d8-6cb689b84e7a","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n  \"type\": \"immediate\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription/xpay_subs_15ce5a77d4fa455b8007b5314a37d49b/pause","urlObject":{"path":["public","v1","subscription","xpay_subs_15ce5a77d4fa455b8007b5314a37d49b","pause"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"c1bf86c5-c703-4e51-94d8-6cb689b84e7a"},{"name":"get all subscriptions","id":"b0f43ef5-a6a7-4919-b160-ffad4ee7093d","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/subscription?status=paid","urlObject":{"path":["public","v1","subscription"],"host":["{{base_url}}"],"query":[{"key":"status","value":"paid"}],"variable":[]}},"response":[],"_postman_id":"b0f43ef5-a6a7-4919-b160-ffad4ee7093d"},{"name":"get a subscription","id":"00332d86-5bed-423e-a898-9404d797a61c","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"GET","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"url":"{{base_url}}/public/v1/subscription/xpay_subs_2a2cef4bf6d447ffa1aebb958992835e","urlObject":{"path":["public","v1","subscription","xpay_subs_2a2cef4bf6d447ffa1aebb958992835e"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"00332d86-5bed-423e-a898-9404d797a61c"},{"name":"update a subscription","id":"37085e33-056b-43fe-9c90-55729b9139fc","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"User-Agent","value":"Apidog/1.0.0 (https://apidog.com)"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"timezone\": \"Asia/Muscat\",\n    \"start_date\": \"2024-07-16T11:39:00Z\", // it will change billing cycle of the upcoming invoices from the given date.\n    \"payment\": {\n        \"latest_product_price\": false, //add only if product array is added\n        \"amount\": 5000, // If it's added it will update overall price of subscription unless plan id is added.\n        \"currency\": \"PKR\"\n    },\n    \"plan_id\": \"xpay_plan_6f51cae83bbb45bd8588fe0c95e4c2b6\", // If this value is added, it will update latest billing cycle, proucts and payment from plan ID and over ride any such value being added in the payload.\n    \"product\": [\n        {\n            \"name\": \"Ali\",\n            \"product_id\": \"xpay_product_90e8c92b774641adad16325722fe8c20\",\n            \"quantity\": 1,\n            \"price\": 100\n        },\n        {\n            \"name\": \" Raza\",\n            \"product_id\": \"xpay_product_e302a0a0ec984e18aadd09e296323c8c\",\n            \"quantity\": 1,\n            \"price\": 50\n        }\n    ],\n    \"billing_cycle\": {\n        \"interval\": \"month\",\n        \"every\": 1,\n        \"total_count\": 2\n    },\n    \"payment_retries_timing\": [\n        {\n            \"date\": \"0\",\n            \"hour\": \"0\"\n        }\n    ],\n    \"admin_settings\": {\n        \"allowed_retries\": 4\n    },\n    \"proration\": {\n        \"behaviour\": \"invoice_now\", //for more details on proration, refer to https://flower-baker-8de.notion.site/d1fb4d6ecdf344bfb035d31aaf9c105f?pvs=25#3c6cf39e3870470a9ebeac19fd6f3a8f\n        \"upgrade_after_payment\": true, // subscription will be updated after an invoice is paid, otherwise it will continue as same.\n        \"next_billing_cycle\": true // instead of creating prorated refund invoice, it will not modify anything for the current ongoing cycle and when the current cycle ends, new plan will get apply.\n    }\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/subscription/xpay_subs_1243653c1f2b4508a86bc60c22b8fe32","urlObject":{"path":["public","v1","subscription","xpay_subs_1243653c1f2b4508a86bc60c22b8fe32"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"37085e33-056b-43fe-9c90-55729b9139fc"},{"name":"Create subscription with PI","id":"dbda00cc-f2be-4994-9ec0-9bcce2d76ab1","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}","type":"text"},{"key":"x-account-id","value":"{{x-account-id}}","type":"text"},{"key":"x-signature","value":"27896049a4174f6b2a0bdf99a0c58c8cb9d006c4e339e1903c1fc7679a7bb998","type":"text"},{"key":"Content-Type","value":"application/json","type":"text"}],"body":{"mode":"raw","raw":"{\r\n    \"payment_method_types\": \"card\",\r\n    \"customer\": {\r\n        \"name\": \"\",\r\n        \"email\": \"\",\r\n        \"phone\": \"\"\r\n    },\r\n    \"shipping\": {\r\n        \"address1\": \"\",\r\n        \"city\": \"\",\r\n        \"country\": \"\",\r\n        \"zip\": \"\",\r\n        \"shipping_method\": \"Standard\"\r\n    },\r\n    \"metadata\": {\r\n        \"order_reference\": \"MPGS-08b\",\r\n        \"reason\": \"token\" // required\r\n    },\r\n    \"subscription\": {\r\n        \"plan_id\": \"xpay_plan_4a717ae404484a0899e029ca46bc5d5f\",\r\n        \"start_date\": \"2024-07-16T11:39:00Z\", // ISO date string to start subscription. Please note that we don't format timezone for subscription scheduler.\r\n        \"timezone\": \"Asia/Karachi\",\r\n        \"payment_retries_timing\": [ //optional field as per number of allowed retries\r\n            {\r\n                \"date\": 0,\r\n                \"hour\": 0,\r\n                \"minute\": 3\r\n            }\r\n        ]\r\n    }\r\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/payment/intent/","urlObject":{"path":["public","v1","payment","intent",""],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"dbda00cc-f2be-4994-9ec0-9bcce2d76ab1"}],"id":"48bc5130-e26d-4730-9623-9d0af67bd192","_postman_id":"48bc5130-e26d-4730-9623-9d0af67bd192","description":""},{"name":"Invoices","item":[{"name":"Create an Invoice","id":"f3f00634-3ea7-4112-8b3c-cf22041745d0","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"subscription_id\": \"xpay_subs_056bad7d10674555aaef770fdaed39cf\",\n    \"state\": \"draft\", //optional\n    \"amount\":\"5\", //optional\n    \"currency\":\"PKR\", //optional\n    \"scheduled_date\":\"2024-07-19T18:09:00Z\", //optional\n    \"enable_scheduler\":true //optional\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/invoice","description":"<p>The create an invoice API can be used to manually create and schedule invoice in existing subscription.</p>\n","urlObject":{"path":["public","v1","invoice"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"f3f00634-3ea7-4112-8b3c-cf22041745d0"},{"name":"Update an invoice","id":"0870d8ea-ddd9-41a7-aab3-0ab7398170db","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"PATCH","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n    \"state\":\"paid\",\n    \"currency\":\"PKR\",\n    \"amount\":\"140\"\n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/invoice/xpay_invoice_346e530db6a0471c8ffe95a17157c3e0","urlObject":{"path":["public","v1","invoice","xpay_invoice_346e530db6a0471c8ffe95a17157c3e0"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"0870d8ea-ddd9-41a7-aab3-0ab7398170db"},{"name":"Pay an invoice","id":"d9fcebc7-a2e1-4464-b754-e7c0fb302868","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"{\n   \"send_payment_link_on_failure\":\"true\" \n}","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/invoice/xpay_invoice_63c6b3045b9542f8bd5c71ddfd2acd25/pay","urlObject":{"path":["public","v1","invoice","xpay_invoice_63c6b3045b9542f8bd5c71ddfd2acd25","pay"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"d9fcebc7-a2e1-4464-b754-e7c0fb302868"},{"name":"Refund an invoice","id":"3cdaf8d4-f230-4c9d-9f60-98584323c5cd","protocolProfileBehavior":{"disableBodyPruning":true},"request":{"method":"POST","header":[{"key":"x-api-key","value":"{{x-api-key}}"},{"key":"x-account-id","value":"{{x-account-id}}"},{"key":"Content-Type","value":"application/json"}],"body":{"mode":"raw","raw":"","options":{"raw":{"language":"json"}}},"url":"{{base_url}}/public/v1/invoice/xpay_invoice_63c6b3045b9542f8bd5c71ddfd2acd25/refund","urlObject":{"path":["public","v1","invoice","xpay_invoice_63c6b3045b9542f8bd5c71ddfd2acd25","refund"],"host":["{{base_url}}"],"query":[],"variable":[]}},"response":[],"_postman_id":"3cdaf8d4-f230-4c9d-9f60-98584323c5cd"}],"id":"db488967-e671-44d2-a0c0-a89d9cc9b0cc","_postman_id":"db488967-e671-44d2-a0c0-a89d9cc9b0cc","description":""}],"id":"4f29fab3-89e1-43e1-935b-e46941b917c8","description":"<p>Please refer to <a href=\"https://xpay-subscription.notion.site/XPay-Subscription-010c885fdaff46dc86cfe1c63cf3d546\">https://xpay-subscription.notion.site/XPay-Subscription-010c885fdaff46dc86cfe1c63cf3d546</a> for detailed documentation of Subscription.</p>\n","_postman_id":"4f29fab3-89e1-43e1-935b-e46941b917c8"}]}