Braintree Payments

Brain integration supports the purchase payment method.

post
Pay by card

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
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 is the only available method for Braintree
gateway
required
string
You will use braintree in this case
options.custom_fields
optional
object
Available for preconfigured custom fields in Braintree
201: Created
Will return the updated transaction if the payment is successful.
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "braintree",
"gateway": "braintree",
"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/:order_id/payments \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"gateway": "braintree",
"method": "purchase",
"first_name": "John",
"last_name": "Smith",
"number": "4242424242424242",
"month": "10",
"year": "2021",
"verification_value": "123"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const orderId = 'XXXX'
Moltin.Orders.Payment(orderId, {
gateway: 'braintree',
method: 'purchase',
first_name: 'John',
last_name: 'Smith',
number: '4242424242424242',
month: '10',
year: '2021',
verification_value: '123'
}).then(() => {
// Do something
})

post
Pay by Customer ID

https://api.moltin.com/v2/orders/:orderId/payments
This method allows you to bill a specific Braintree customer. Braintree will be the default billing method in the customer's account.
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.custom_fields
optional
string
Available for preconfigured custom fields in Braintree
payment
required
string
The Braintree Customer ID that you want to bill
method
required
string
purchase is the only payment method for Braintree
gateway
required
string
You will use braintree in this case
201: Created
Will return the updated transaction if the payment is successful
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "braintree",
"gateway": "braintree",
"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/:order_id/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "braintree",
"method": "purchase",
"payment": BRAINTREE_CUSTOMER_ID
}
}'
Moltin.Orders.Payment('orderId', {
gateway: "braintree",
method: "purchase",
payment: BRAINTREE_CUSTOMER_ID
}).then(() => {
// Do something
});

post
Pay by Token

https://api.moltin.com/v2/orders/:orderId/payments
This endpoint allows you to pay for an order with a specific Braintree Payment Method Token. This is similar to the Customer ID payment type, but you can define a specific payment source to charge.
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
gateway
required
string
You will use braintree in this case
method
required
string
purchase is the only payment method for Braintree
payment
required
string
The Braintree Customer ID you want to bill
options.payment_method_token
required
string
The payment method token to charge
options.custom_fields
optional
string
Available for preconfigured custom fields in Braintree
201: Created
Will return the updated transaction if the payment is successful.
{
"data": {
"id": "5c3eeef0-a5f4-4d04-b990-822521e8604d",
"type": "transaction",
"reference": "cz7dekqq",
"gateway": "braintree",
"amount": 10000,
"currency": "GBP",
"transaction-type": "purchase",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "551ba7c2-7658-4abe-a530-6de0f6095010"
}
}
},
"meta": {
"display_price": {
"amount": 10000,
"currency": "GBP",
"formatted": "£100.00"
},
"created_at": "2019-07-02T10:05:42.11Z"
}
}
}
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/orders/:order_id/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "braintree",
"method": "purchase",
"payment": BRAINTREE_CUSTOMER_ID,
"options": {
"payment_method_token": BRAINTREE_PAYMENT_METHOD_TOKEN
}
}
}'
Moltin.Orders.Payment('orderId', {
gateway: "braintree",
method: "purchase",
payment: BRAINTREE_CUSTOMER_ID,
options: {
payment_method_token: BRAINTREE_PAYMENT_METHOD_TOKEN
}
}).then(() => {
// Do something
});

post
Pay by Nonce

https://api.moltin.com/v2/orders/:orderId/payments
This endpoint allows you to pay for an order with a previously created Braintree Payment Method Nonce.
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
gateway
required
string
You will use braintree in this case
method
required
string
purchase is the only payment method for Braintree
payment
required
string
The Braintree Payment Nonce ID
options.payment_method_nonce
required
boolean
Set this to true
options.custom_fields
optional
string
Available for preconfigured custom fields in Braintree
201: Created
Will return the updated transaction if the payment is successful.
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "braintree",
"gateway": "braintree",
"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"
}
}
}

post

https://api.moltin.com/v2/orders/:orderId/payments
Request
Response
Path Parameters
optional
string
201: Created
Will return the updated transaction if the payment is successful.

post

https://api.moltin.com/v2/orders/:orderId/payments
Request
Response
Path Parameters
optional
string
201: Created
Will return the updated transaction if the payment is successful.
cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/orders/{ORDER_ID}/payments \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "braintree",
"method": "purchase",
"payment": BRAINTREE_PAYMENT_NONCE,
"options": {
"payment_method_nonce": true
}
}
}'
Moltin.Orders.Payment('orderId', {
gateway: "braintree",
method: "purchase",
payment: BRAINTREE_PAYMENT_NONCE,
options: {
payment_method_nonce: true
}
}).then(() => {
// Do something
});