Stripe Payment Intents
The Stripe payment intents integration supports the following payment methods:
authorize
capture
purchase
refund
POST
Pay by token or source
https://api.moltin.com/v2/orders/:orderId/payments
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
orderId | Required | string | The Universally Unique Identifier (UUID) of the order that you want to pay for. |
Headers:
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token to grant access to the API. |
Body:
Name | Required | Type | Description |
---|---|---|---|
options.idempotency_key | Optional | string | The option to send a Stripe Idempotency Key. |
options.receipt_email | Optional | string | The option to provide an email for Stripe receipts. Specify live mode to access this feature. |
payment | Required | string | The Stripe token or source. |
options.customer | Optional | string | The Stripe customer ID. This is required if you are sending a source. |
method | Required | string | Enter purchase or authorize as the required method. |
gateway | Required | string | Enter stripe_payment_intents as the required gateway. |
201 Created
Note: In the actual response, the letter x is replaced with the returned values.
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "pi_xxxxxxxxxxxxx",
"gateway": "stripe_payment_intents",
"amount": 5499,
"currency": "USD",
"transaction-type": "purchase",
"transaction_type": "purchase",
"status": "pending",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
},
"meta": {
"display_price": {
"amount": 5499,
"currency": "USD",
"formatted": "$54.99"
},
"created_at": "2019-08-28T10:40:21.925Z",
"timestamps": {
"created_at": "2019-08-28T10:40:21Z",
"updated_at": "2019-08-28T10:40:23Z"
}
},
"client_parameters": {
"token": "pi_xxxxxxxxxxxxxxxx",
"secret": "pi_xxxxxxxxxxxxxx_secret_xxxxxxxxxxxxxx"
}
}
}
note
If you are passing a source
instead of a token
, you must also include the Stripe customer ID in the request.
curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe_payment_intents",
"method": "purchase",
"payment": "pm_card_threeDSecureRequired",
"options": {
"receipt_email": "john@example.com"
}
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const id = 'XXXX'
const payment = {
gateway: 'stripe_payment_intents',
method: 'purchase',
payment: 'pm_card_threeDSecureRequired'
}
Moltin.Orders.Payment(id, payment).then(() => {
// Do something
})
warning
We recommend that you use the token or source with Stripe payments. For more information about generating a token on the client-side, see the Stripe Elements documentation.
POST
Pay by Stripe Connect
https://api.moltin.com/v2/orders/:orderId/payments
Elastic Path Commerce Cloud also supports Stripe Connect. To access Stripe Connect, pass a destination through the options object.
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
orderId | Required | string | The UUID of the order that you want to pay for. |
Headers:
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token used to grant access to the API. |
Body:
Name | Required | Type | Description |
---|---|---|---|
options.destination | Optional | string | The Stripe Connect Account ID. |
options.receipt_email | Optional | string | The option to provide an email for Stripe receipts. Specify the live mode to access this feature. |
payment | Required | string | The Stripe token or source. |
method | Required | string | Enter purchase or authorize as the required method. |
gateway | Required | string | Enter stripe_payment_intents as the required gateway. |
201 Created
Note: In the actual response, the letter x is replaced with the returned values.
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "pi_xxxxxxxxxxxxxxxx",
"gateway": "stripe_payment_intents",
"amount": 5499,
"currency": "USD",
"transaction-type": "purchase",
"transaction_type": "purchase",
"status": "pending",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
},
"meta": {
"display_price": {
"amount": 5499,
"currency": "USD",
"formatted": "$54.99"
},
"created_at": "2019-08-28T10:40:21.925Z",
"timestamps": {
"created_at": "2019-08-28T10:40:21Z",
"updated_at": "2019-08-28T10:40:23Z"
}
},
"client_parameters": {
"token": "pi_xxxxxxxxxxxxxxxx",
"secret": "pi_xxxxxxxxxxxxxx_secret_xxxxxxxxxxxxxx"
}
}
}
curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe_payment_intents",
"method": "purchase",
"payment": "pm_card_threeDSecureRequired",
"options": {
"destination": "acct_XXX",
"receipt_email": "john@example.com"
}
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const id = 'XXXX'
const payment = {
gateway: 'stripe_payment_intents',
method: 'purchase',
payment: 'pm_card_threeDSecureRequired',
options: {
destination: "acct_XXX",
receipt_email: "john@example.com"
}
}
Moltin.Orders.Payment(id, payment).then(() => {
// Do something
})
POST
Confirm the security validation succeeded
https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/confirm
In some cases, Stripe requires client action to perform a 3D Secure validation. You can identify these cases by the presence of client_parameters
in the response body. Use the Stripe client libraries to process them. When the validation succeeds, you can continue the payment processing by issuing following POST
request:
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
orderId | Required | string | The UUID of the order that you want to pay for. |
transactionId | Required | string | The UUID of the transaction that required client action. |
Headers:
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token to grant access to the API. |
Body:
Name | Required | Type | Description |
---|---|---|---|
method | Required | string | The required method, such as purchase or authorize . |
gateway | Required | string | Specify stripe_payment_intents for the required gateway. |
payment | Required | string | The Stripe token or source. |
201 Created
Note: In the actual response, the letter x is replaced with the returned values.
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "xxxxxx",
"gateway": "stripe_payment_intents",
"amount": 100,
"currency": "USD",
"transaction_type": "purchase",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
},
"meta": {
"display_price": {
"amount": 100,
"currency": "USD",
"formatted": "$100.00"
},
"timestamps": {
"created_at": "2020-05-25T20:58:57Z",
"updated_at": "2020-05-25T13:59:01-07:00"
}
}
}
}
curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/confirm \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe_payment_intents",
"method": "purchase",
"payment" : "xxxxxxxxxxx"
}
}'
POST
Capture the payment authorization
https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/capture
Path Parameters:
Name | Required | Type | Description |
---|---|---|---|
orderId | Required | string | The UUID of the order that you want to pay for. |
transactionId | Required | string | The UUID of the successful authorize transaction. |
Headers:
Name | Required | Type | Description |
---|---|---|---|
Authorization | Required | string | The Bearer token to grant access to the API. |
201 Created
Note: In the actual response, the letter x is replaced with the returned values.
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "xxxxxx",
"gateway": "stripe_payment_intents",
"amount": 100,
"currency": "USD",
"transaction_type": "capture",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx"
}
}
},
"meta": {
"display_price": {
"amount": 100,
"currency": "USD",
"formatted": "$100.00"
},
"timestamps": {
"created_at": "2020-05-25T20:58:57Z",
"updated_at": "2020-05-25T13:59:01-07:00"
}
}
}
}
curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/capture \
-H "Authorization: Bearer XXXX"