Stripe Payments

2
Last updated 12 days ago

Stripe integration supports the purchase, authorize and capture payment methods.

post
Pay by token or source

https://api.moltin.com
/v2/orders/:orderId/payments
Request
Response
Path Parameters
orderId
required
string
The UUID of the order you want to pay for
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
options.idempotency_key
optional
string
Send a Stripe Idempotency Key
options.receipt_email
optional
string
Provide an email for Stripe receipts. live mode feature
payment
required
string
The Stripe token or source
options.customer
optional
string
The Stripe customer ID (required if sending source)
method
required
string
purchase, authorize, capture
gateway
required
string
You will use stripe in this case
200: OK
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "stripe",
"gateway": "stripe",
"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"
},
"created_at": "2019-01-31T17:20:39.378Z"
}
}
}

If you are passing a source instead of a token, you must also include the Stripe customer ID in the request

cURL
JavaScript SDK
Swift SDK
curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe",
"method": "purchase",
"payment": "tok_visa",
"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',
method: 'purchase',
payment: 'tok_visa'
}
Moltin.Orders.Payment(id, payment).then(() => {
// Do something
})
let moltin = Moltin(withClientID: "<your client ID>")
let paymentMethod = StripeToken(withStripeToken: ...)
moltin.cart.pay(
forOrderID: order.id,
withPaymentMethod: paymentMethod) { (result) in
...
}

It's recommended that you use the token/source with Stripe payments. See Stripe Elements for generating a token on the client-side.

post
Pay by card

https://api.moltin.com
/v2/orders/:order_id/payments
Request
Response
Path Parameters
order_id
required
string
The UUID of the order you want to pay for
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
options.receipt_email
optional
string
Provide an email for Stripe receipts. live mode feature
verification_value
required
string
The CVV/CVC code from the back of the card
year
required
string
The expiry year of the card
month
required
string
The expiry month of the card
number
required
string
The full card number
last_name
required
string
The last name of the card owner
first_name
required
string
The first name of the card owner
method
required
string
purchase, authorize, capture
gateway
required
string
You will use stripe in this case
200: OK
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "stripe",
"gateway": "stripe",
"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"
},
"created_at": "2019-01-31T17:20:39.378Z"
}
}
}
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe",
"method": "purchase",
"first_name": "John",
"last_name": "Smith",
"number": "4242424242424242",
"month": "10",
"year": "2020",
"verification_value": "123",
"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',
method: 'purchase',
first_name: "John",
last_name: "Smith",
number: "4242424242424242",
month: "10",
year: "2020",
verification_value: "123"
}
Moltin.Orders.Payment(id, payment).then(() => {
// Do something
})

post
Pay by Stripe Connect

https://api.moltin.com
/v2/orders/:orderId/payments
Moltin also supports Stripe Connect. Simply pass a destination via the options object.
Request
Response
Path Parameters
orderId
required
string
The UUID of the order you want to pay for
Headers
Authorization
required
string
The Bearer token used to grant access to the API
Body Parameters
options.destination
optional
string
The Stripe Connect Account ID
options.receipt_email
optional
string
Provide an email for Stripe receipts. live mode only
payment
required
string
The Stripe token or source
method
required
string
purchase, authorize, capture
gateway
required
string
You will use stripe in this case
200: OK
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "stripe",
"gateway": "stripe",
"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"
},
"created_at": "2019-01-31T17:20:39.378Z"
}
}
}
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe",
"method": "purchase",
"payment": "tok_visa",
"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',
method: 'purchase',
payment: 'tok_visa'
options: {
destination: 'acct_XXX'
}
}
Moltin.Orders.Payment(id, payment).then(() => {
// Do something
})