4. Pay for your order
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:‌
​Stripe​
​Braintree​
​CardConnect​
​Adyen​
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.
Once completed you will receive your access_token
.
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.
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.
Congratulations! 🎉 You have now successfully paid for your unpaid order.
Last updated