POST https://api.stripay.io/v1/direct/pay
Field | Type | Required | Description |
---|---|---|---|
key | String | ✅ | Stripay merchant key |
merchantOrderId | String | ✅ | Your order id, maximum length is 64 characters |
amount | Double | ✅ | Amount, up to 2 decimal |
currency | String | ❌ | Currency, 3-letter ISO code, default USD |
successUrl | String | ✅ | Payment successful redirect url, maximum length is 1024 characters |
failUrl | String | ✅ | Payment failed redirect url, maximum length is 1024 characters |
notifyUrl | String | ❌ | Notify url, when the order status changes, send a notification to this URL |
cardNumber | String | ✅ | Credit card number, eg: 4242424242424242 |
cardExpYear | String | ✅ | Credit card expire year, eg: 2028 |
cardExpMonth | String | ✅ | Credit card expire month, eg: 08 |
cardCvc | String | ✅ | Credit card cvc, eg: 888 |
cardHolderName | String | ❌ | Credit card holder name, eg: Elon Musk |
ip | String | ✅ | Customer IP |
String | ✅ | Customer email | |
phone | String | ✅ | Customer phone number, eg: +1xxxxxxxxxxx |
goods | Array | ✅ | { sku: '1', title: 'test', quantity: '1', amount: '9.9', image: 'https://xxx.com/test.jpeg', url: 'https://xxx.com/product/test/' } |
billingFirstName | String | ❌ | Billing firstname |
billingLastName | String | ❌ | Billing lastname |
billingCountry | String | ❌ | Billing country, 2-letter ISO code, eg: US |
billingState | String | ❌ | Billing state, 2-letter ISO code, eg: CA |
billingCity | String | ❌ | Billing city, eg: Fullerton |
billingLine1 | String | ❌ | Billing street line 1 |
billingLine2 | String | ❌ | Billing street line 2 |
billingPostCode | String | ❌ | Billing postcode |
force3ds | Boolean | ❌ | Whether to force 3ds to be enabled, default false |
plugin | String | ❌ | Plugin name, eg: wordpress_v1.0.0 |
ua | String | ❌ | User agent, eg: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36. Browser: navigator.userAgent |
timezone | String | ❌ | timezone, eg: Asia/Shanghai. Browser: Intl.DateTimeFormat().resolvedOptions().timeZone |
locale | String | ❌ | locale, eg: zh-CN. Browser: Intl.DateTimeFormat().resolvedOptions().locale |
languages | String | ❌ | languages, eg: zh-CN,en. Browser: navigator.languages.join(',') |
resolution | String | ❌ | Screen resolution, eg: 1920x1080. Browser: screen.width + 'x' + screen.height |
POST https://api.stripay.io/v1/inline/pay
Field | Type | Required | Description |
---|---|---|---|
key | String | ✅ | Stripay merchant key |
merchantOrderId | String | ✅ | Your order id, maximum length is 64 characters |
amount | Double | ✅ | Amount, up to 2 decimal |
currency | String | ❌ | Currency, 3-letter ISO code, default USD |
successUrl | String | ✅ | Payment successful redirect url, maximum length is 1024 characters |
failUrl | String | ✅ | Payment failed redirect url, maximum length is 1024 characters |
notifyUrl | String | ❌ | Notify url, when the order status changes, send a notification to this URL |
ip | String | ✅ | Customer IP |
String | ✅ | Customer email | |
phone | String | ✅ | Customer phone number, eg: +1xxxxxxxxxxx |
goods | Array | ✅ | { sku: '1', title: 'test', quantity: '1', amount: '9.9', image: 'https://xxx.com/test.jpeg', url: 'https://xxx.com/product/test/' } |
billingFirstName | String | ❌ | Billing firstname |
billingLastName | String | ❌ | Billing lastname |
billingCountry | String | ❌ | Billing country, 2-letter ISO code, eg: US |
billingState | String | ❌ | Billing state, 2-letter ISO code, eg: CA |
billingCity | String | ❌ | Billing city, eg: Fullerton |
billingLine1 | String | ❌ | Billing street line 1 |
billingLine2 | String | ❌ | Billing street line 2 |
billingPostCode | String | ❌ | Billing postcode |
force3ds | Boolean | ❌ | Whether to force 3ds to be enabled, default false |
plugin | String | ❌ | Plugin name, eg: wordpress_v1.0.0 |
ua | String | ❌ | User agent, eg: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36. Browser: navigator.userAgent |
timezone | String | ❌ | timezone, eg: Asia/Shanghai. Browser: Intl.DateTimeFormat().resolvedOptions().timeZone |
locale | String | ❌ | locale, eg: zh-CN. Browser: Intl.DateTimeFormat().resolvedOptions().locale |
languages | String | ❌ | languages, eg: zh-CN,en. Browser: navigator.languages.join(',') |
resolution | String | ❌ | Screen resolution, eg: 1920x1080. Browser: screen.width + 'x' + screen.height |
iframeElement.contentWindow.postMessage({ action: 'pay' })
window.addEventListener('message', (e) => { if (e.data.sender === 'stripay') { if (e.data.action === 'pay_success') { // payment success, e.data.value is successUrl location.href = e.data.value } else if (e.data.action === 'pay_fail') { // payment failed, e.data.value is error message errorElement.innerHTML = e.data.value } else if (e.data.action === 'pay_3ds') { // trigger 3DS, e.data.value is iframe height iframeElement.style.setProperty('height', e.data.value + 'px') } else if (e.data.action === 'pay_validate_error') { // credit card verification failed, e.data.value is error message errorElement.innerHTML = e.data.value } else if (e.data.action === 'height') { // iframe height changed, e.data.value is iframe height iframeElement.style.setProperty('height', e.data.value + 'px') } } })
POST https://api.stripay.io/v1/checkout/pay
Field | Type | Required | Description |
---|---|---|---|
key | String | ✅ | Stripay merchant key |
merchantOrderId | String | ✅ | Your order id, maximum length is 64 characters |
amount | Double | ✅ | Amount, up to 2 decimal |
currency | String | ❌ | Currency, 3-letter ISO code, default USD |
successUrl | String | ✅ | Payment successful redirect url, maximum length is 1024 characters |
failUrl | String | ✅ | Payment failed redirect url, maximum length is 1024 characters |
notifyUrl | String | ❌ | Notify url, when the order status changes, send a notification to this URL |
ip | String | ✅ | Customer IP |
String | ✅ | Customer email | |
phone | String | ✅ | Customer phone number, eg: +1xxxxxxxxxxx |
goods | Array | ✅ | { sku: '1', title: 'test', quantity: '1', amount: '9.9', image: 'https://xxx.com/test.jpeg', url: 'https://xxx.com/product/test/' } |
billingFirstName | String | ❌ | Billing firstname |
billingLastName | String | ❌ | Billing lastname |
billingCountry | String | ❌ | Billing country, 2-letter ISO code, eg: US |
billingState | String | ❌ | Billing state, 2-letter ISO code, eg: CA |
billingCity | String | ❌ | Billing city, eg: Fullerton |
billingLine1 | String | ❌ | Billing street line 1 |
billingLine2 | String | ❌ | Billing street line 2 |
billingPostCode | String | ❌ | Billing postcode |
force3ds | Boolean | ❌ | Whether to force 3ds to be enabled, default false |
plugin | String | ❌ | Plugin name, eg: wordpress_v1.0.0 |
ua | String | ❌ | User agent, eg: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36. Browser: navigator.userAgent |
timezone | String | ❌ | timezone, eg: Asia/Shanghai. Browser: Intl.DateTimeFormat().resolvedOptions().timeZone |
locale | String | ❌ | locale, eg: zh-CN. Browser: Intl.DateTimeFormat().resolvedOptions().locale |
languages | String | ❌ | languages, eg: zh-CN,en. Browser: navigator.languages.join(',') |
resolution | String | ❌ | Screen resolution, eg: 1920x1080. Browser: screen.width + 'x' + screen.height |
POST https://api.stripay.io/v1/paypal/pay
Field | Type | Required | Description |
---|---|---|---|
key | String | ✅ | Stripay merchant key |
merchantOrderId | String | ✅ | Your order id, maximum length is 64 characters |
amount | Double | ✅ | Amount, up to 2 decimal |
currency | String | ❌ | Currency, 3-letter ISO code, default USD |
successUrl | String | ✅ | Payment successful redirect url, maximum length is 1024 characters |
failUrl | String | ✅ | Payment failed redirect url, maximum length is 1024 characters |
notifyUrl | String | ❌ | Notify url, when the order status changes, send a notification to this URL |
ip | String | ✅ | Customer IP |
String | ✅ | Customer email | |
phone | String | ✅ | Customer phone number, eg: +1xxxxxxxxxxx |
goods | Array | ✅ | { sku: '1', title: 'test', quantity: '1', amount: '9.9', image: 'https://xxx.com/test.jpeg', url: 'https://xxx.com/product/test/' } |
billingFirstName | String | ❌ | Billing firstname |
billingLastName | String | ❌ | Billing lastname |
billingCountry | String | ❌ | Billing country, 2-letter ISO code, eg: US |
billingState | String | ❌ | Billing state, 2-letter ISO code, eg: CA |
billingCity | String | ❌ | Billing city, eg: Fullerton |
billingLine1 | String | ❌ | Billing street line 1 |
billingLine2 | String | ❌ | Billing street line 2 |
billingPostCode | String | ❌ | Billing postcode |
plugin | String | ❌ | Plugin name, eg: wordpress_v1.0.0 |
ua | String | ❌ | User agent, eg: Mozilla/5.0 (Macintosh; Intel Mac OS X 10_15_7) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/136.0.0.0 Safari/537.36. Browser: navigator.userAgent |
timezone | String | ❌ | timezone, eg: Asia/Shanghai. Browser: Intl.DateTimeFormat().resolvedOptions().timeZone |
locale | String | ❌ | locale, eg: zh-CN. Browser: Intl.DateTimeFormat().resolvedOptions().locale |
languages | String | ❌ | languages, eg: zh-CN,en. Browser: navigator.languages.join(',') |
resolution | String | ❌ | Screen resolution, eg: 1920x1080. Browser: screen.width + 'x' + screen.height |
Field | Type | Required | Description |
---|---|---|---|
status | String | ✅ | success/fail/3ds |
statusNote | String | ❌ | Payment failed message |
redirectUrl | String | ✅ | Payment redirect url |
POST https://api.stripay.io/v1/checkout/pay
Request body:
{ "key": "098f6bcd4621d373cade4e832627b4f6", "merchantOrderId": "1", "amount": 0.99, "successUrl": "https://stripay.io/v1/success.html", "failUrl": "https://stripay.io/v1/fail.html", "ip": "38.94.109.229", "email": "[email protected]" }
Successful response body:
{ "status": "success", "statusNote": null, "redirectUrl": "https://stripay.io/v1/success.html" }
Failed response body:
{ "status": "fail", "statusNote": "No account avaliable", "redirectUrl": "https://stripay.io/v1/fail.html" }
Need to redirect to the URL of the payment/3DS page:
{ "status": "3ds", "statusNote": null, "redirectUrl": "https://checkout.stripe.com/c/pay/cs_test_xxx" }
POST https://api.stripay.io/v1/orders
Request body:
{ "key": "098f6bcd4621d373cade4e832627b4f6", "page": 1, "limit": 20 // range of [20, 100] }
Response body:
{ "total": 90, "orders": [ { "id": 1, "merchantId": 1, "merchantOrderId": "your order id", "amount": 1.99, "currency": "USD", "successUrl": "https://stripay.io/v1/success.html", "failUrl": "https://stripay.io/v1/fail.html", "email": "[email protected]", "ip": "102.171.177.216", "riskScore": 65, "status": "completed", "statusNote": null, "is3ds": false, "createdAt": "2023-02-14T12:39:13.000Z", "updatedAt": "2023-02-14T12:39:21.000Z" } ] }
POST https://api.stripay.io/v1/order
Request body:
{ "key": "098f6bcd4621d373cade4e832627b4f6", "merchantOrderId": "merchant order id", // merchantOrderId and orderId, choose one "orderId": "stripay order id" // Recommend. merchantOrderId and orderId, choose one }
Response body:
{ "order": { "id": 1, "merchantId": 1, "merchantOrderId": "your order id", "amount": 1.99, "currency": "USD", "successUrl": "https://stripay.io/v1/success.html", "failUrl": "https://stripay.io/v1/fail.html", "email": "[email protected]", "ip": "102.171.177.216", "riskScore": 0, "status": "rejected", "statusNote": "No valid payment method types for this Checkout Session.", "is3ds": false, "createdAt": "2023-01-10T03:39:53.000Z", "updatedAt": "2023-01-10T03:43:37.000Z" } }
The order status has the following values:
If you pass notifyUrl when creating an order, a POST request will be made to notifyUrl when the order status changes (completed/refunded/disputed), with the following content:
{ "id": 1, "merchantId": 1, "merchantOrderId": "your order id", "amount": 1.99, "currency": "USD", "successUrl": "https://stripay.io/v1/success.html", "failUrl": "https://stripay.io/v1/fail.html", "email": "[email protected]", "ip": "102.171.177.216", "riskScore": 0, "status": "completed", "statusNote": null, "is3ds": false, "createdAt": "2023-01-10T03:39:53.000Z", "updatedAt": "2023-01-10T03:43:37.000Z", "sign": "4a04cdd85f623f3785fe29655b03854f" }
notifyUrl needs to return an OK string, otherwise it is considered a failure. Stripay will try up to 5 times: immediately, after 10 minutes, after 30 minutes, after 60 minutes, after one day.
Sort all parameter keys in lexicographic order, concatenate their values, and finally concatenate the merchant key to calculate md5. eg:
function genSign (key, data) { let signStr = '' Object.keys(data) .sort() .forEach(key => { if (key === 'sign') { return } const value = data[key] if (value === '' || value == null) { return } signStr += value }) return md5(signStr + key) }
Test account and test credit card reference: