Unlike regular web-based methods, the redirection should be performed not simply to a URL, but through a JS call.
init
PATCH api/storefront/carts/{cart-id}/payment/{public-txn-id}
{
"action": "init",
"actionMetaData": [
{
"name": "success_url",
"value": "http://xcart.test/payment_return/{cart-id}/{public-txn-id}"
},
{
"name": "cancel_url",
"value": "http://xcart.test/payment_return/{cart-id}/{public-txn-id}"
}
]
}
Response example
{
"id": "000007-3TQV",
"status": "P",
"value": 22.74,
"type": "sale",
"data": [
{
"name": "test_mode",
"value": "1"
}
],
"backendTransactions": [],
"processor": "XC\\Stripe\\Model\\Payment\\Stripe",
"actionData": [
{
"@type": "ActionData",
"name": "publishKey",
"value": "pk_test_RkD67blR5ZoMQ1DeurYgcPaw"
}
],
"actionMetaData": [
{
"@type": "ActionMetaData",
"name": "url",
"value": "https://checkout.stripe.com/c/pay/cs_test_a1c9BT4mvQGzyL66ZFHzl8Awd3f3pOIX5Pob1G81S8xCAWV8CKFSkdM6jv#fidkdWxOYHwnPyd1blpxYHZxWlduQTMyZ2lXMF9qSFQ0QWBwd1xiZlVkcicpJ2N3amhWYHdzYHcnP3F3cGApJ2lkfGpwcVF8dWAnPyd2bGtiaWBabHFgaCcpJ2BrZGdpYFVpZGZgbWppYWB3dic%2FcXdwYHgl"
},
{
"@type": "ActionMetaData",
"name": "method",
"value": "get"
}
]
}
pay
PATCH api/storefront/carts/{cart-id}/payment/{public-txn-id}
{
"action": "pay"
}