Braintree Payments

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

NameTypeDescription

order_id

string

The UUID of the order you want to pay for

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API

Request Body

NameTypeDescription

options.custom_fields

string

Available for preconfigured custom fields in Braintree

payment

string

The Braintree Customer ID that you want to bill

method

string

purchase is the only payment method for Braintree

gateway

string

You will use braintree in this case

{
    "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 -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
  }
}'

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

NameTypeDescription

order_id

string

The UUID of the order you want to pay for

Headers

NameTypeDescription

Authorization

string

The Bearer token to grant access to the API

Request Body

NameTypeDescription

gateway

string

You will use braintree in this case

method

string

purchase is the only payment method for Braintree

payment

string

The payment method token to charge

options.payment_method_token

string

You will use true in this case

options.custom_fields

string

Available for preconfigured custom fields in Braintree

{
  "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 -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
    }
  }
}'

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

NameTypeDescription

order_id

string

The UUID of the order you want to pay for

Headers

NameTypeDescription

Authorization

string

the Bearer token to grant access to the API

Request Body

NameTypeDescription

gateway

string

You will use braintree in this case

method

string

purchase is the only payment method for Braintree

payment

string

The Braintree Payment Nonce ID

options.payment_method_nonce

boolean

Set this to true

options.custom_fields

string

Available for preconfigured custom fields in Braintree

{
    "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 -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
    }
  }
}'

Last updated