4. Pay for your order

Last updated 13 days ago

Now that we have an unpaid order, we can move onto using the Payments API.

Before we can use the Payments API, we must first configure a payment gateway.

Payment Gateways

Right now Moltin provides native payment functionality for the following providers:

You will want to use the Manual Gateway if your gateway isn't listed above, you can learn how to use that here.

Configure your gateway

In this example we will be using Stripe. If you want to follow along, login or sign up to Stripe and head to Developers > API keys and make a copy of your secret key.

Next we'll need to tell Moltin the Stripe secret key, but we'll need a client_credentials token to do that.

You'll need your client_id and client_secret from the Moltin Dashboard to do this.

curl -X POST https://api.moltin.com/oauth/access_token \
-d "client_id=XXXX" \
-d "client_secret=XXXX" \
-d "grant_type=client_credentials"

Once completed you will receive your access_token.

"expires": 1537779121,
"identifier": "implicit",
"expires_in": 3600,
"access_token": "9z12127b8d9e20abb3d6e48561cbfe81448956pl",
"token_type": "Bearer"

We can now configure the Stripe gateway using the Moltin API. You may also configure payment gateways via the Moltin Dashboard.

You will need to replace XXXX with your access_token and Stripe secret key below.

curl -X PUT https://api.moltin.com/v2/gateways/stripe \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"enabled": true,
"login": "XXXX"

Make a payment

We now have everything we need to pay for our Order. 🎉

Payments are handled via token and sources. These are secure tokens that permit authorize/capture on your card. Stripe provide many tools to generate tokens, including Stripe.js and Checkout.

Stripe also provides a variety of tokens you can use during test/development environments and in the example below, we will use the tok_visa to simulate a successful VISA payment.

Replace XXXX with your access_token and replace :orderId with your unpaid order ID we created in the previous step.

curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Content-Type: application/json" \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe",
"method": "purchase",
"payment": "tok_visa"

Congratulations! 🎉 You have now successfully paid for your unpaid order.