• Log in
  • Sign up
  • Contact Us

Get in touch  

Blog • Developer

New Moltin payment methods: Stripe tokens/sources and manual gateway

Last updated: 24 Jun 2019

Today we’ve launched some of the most requested payment methods from the last few months; the ability to pay using a Stripe token or source and the manual gateway.

Stripe tokens and sources

First up is an extension to our Stripe payment options. We’ve added in support for payment tokens and sources. This means you can accept credit card payments on your Moltin store through Stripe without the users card details ever having to hit your server.

Using Stripe.js you can generate a single use card token which you then pass to Moltin when paying for the order.

An example using cURL:

Stripe tokens and sources

First up is an extension to our Stripe payment options. We’ve added in support for payment tokens and sources. This means you can accept credit card payments on your Moltin store through Stripe without the users card details ever having to hit your server.

Using Stripe.js you can generate a single use card token which you then pass to Moltin when paying for the order.

An example using cURL:

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

and our JS SDK:

Moltin.Orders.Payment("orderId", {
gateway: "stripe",
method: "purchase",
payment: "tok_visa"
}).then(() => {
// Do something
});

Manual Payments

We’ve also added a new gateway which we’ve named the Manual Gateway. This is perfect for stores that would like to use a gateway we haven’t added support for yet, or if you’d like to accept some form of offline payment. The payment process follows the standard authorize/capture process.

First of all, enable the manual gateway in the gateway section of your store dashboard. At the time of checkout and payment, you make an authorization request. We’ll update the payment status to authorized and the order status to processing. We’ll also create an authorization transaction on this order.

Using cURL:

curl -X "POST" "https://api.moltin.com/v2/orders/{ORDER_ID}/payments" \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "manual",
"method": "authorize",
}
}'

and our JavaScript SDK:

Moltin.Orders.Payment('orderId', {
gateway: "manual",
method: "authorize"
}).then(() => {
// Do something
});

Then you do whatever you need to do on your end to confirm the payment, this might be sending a request to another payment processor or it might be confirming that you have received an offline payment. Once you’re happy you’ve been paid, you can make a second capture request to mark the order as paid, the transaction ID is the ID of the transaction that was created during the authorize request.

curl -X "POST" "https://api.moltin.com/v2/orders/{ORDER_ID}/transactions/{TRANSACTION_ID}/capture" \
-H "Authorization: Bearer XXXX"

For security reasons, we only allow client_credentials tokens to perform this request. Alternatively, you can click the Capture button under any authorized transaction in your store dashboard.

From Our Blog

11 Sep 2019

An Introduction to eCommerce APIs

In this post we’ll cover what an eCommerce API is, why you should use one and how you should evaluate an eCommerce API.

Read More
author
Adam Sturrock
in Developer | eCommerce
21 Aug 2019

Systems quotas to protect your store

Today we are introducing fair usage quotas within our architecture. The use of quotas is common practice for web facing services and their introduction by Moltin is to ensure an optimal and fair...

Read More
author
Jonathan Prest
in Announcements | Developer
20 Jun 2019

Analytics for your Moltin store

Today we’re going to take a look at how to use best-in-class data warehousing and analytics solutions on top of Moltin, specifically in relation to orders and order items.

Read More
author
Matt Foyle
9 min. read in Developer