Brain integration supports the purchase
payment method.
Pay by Customer ID
POST
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.
Path Parameters
Name Type Description The UUID of the order you want to pay for
Name Type Description The Bearer token to grant access to the API
Request Body
Name Type Description Available for preconfigured custom fields in Braintree
The Braintree Customer ID that you want to bill
purchase
is the only payment method for Braintree
You will use braintree
in this case
201 Will return the updated transaction if the payment is successful
Copy {
"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
Copy 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
}
}'
Copy Moltin . Orders .Payment ( 'orderId' , {
gateway : "braintree" ,
method : "purchase" ,
payment : BRAINTREE_CUSTOMER_ID
}) .then (() => {
// Do something
});
Pay by Token
POST
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.
Path Parameters
Name Type Description The UUID of the order you want to pay for
Name Type Description The Bearer token to grant access to the API
Request Body
Name Type Description You will use braintree
in this case
purchase
is the only payment method for Braintree
The payment method token to charge
options.payment_method_token
You will use true
in this case
Available for preconfigured custom fields in Braintree
201 Will return the updated transaction if the payment is successful.
Copy {
"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
Copy 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_METHOD_TOKEN,
"options": {
"payment_method_token": true
}
}
}'
Copy Moltin . Orders .Payment ( 'orderId' , {
gateway : "braintree" ,
method : "purchase" ,
payment : BRAINTREE_CUSTOMER_ID ,
options : {
payment_method_token : BRAINTREE_PAYMENT_METHOD_TOKEN
}
}) .then (() => {
// Do something
});
Pay by Nonce
POST
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.
Path Parameters
Name Type Description The UUID of the order you want to pay for
Name Type Description the Bearer token to grant access to the API
Request Body
Name Type Description You will use braintree
in this case
purchase
is the only payment method for Braintree
The Braintree Payment Nonce ID
options.payment_method_nonce
Available for preconfigured custom fields in Braintree
201 Will return the updated transaction if the payment is successful.
Copy {
"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
Copy 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
}
}
}'