Manual Payments

1
Last updated 2 months ago

Out of the box we are able to support an unlimited amount of payment gateways using the Manual Payments API.

The manual gateway currently supports the authorize and capture methods only.

post
Authorize payment

https://api.moltin.com
/v2/orders/:orderId/payments
Request
Response
Path Parameters
orderId
required
string
The UUID of the order you want to authorize payment for
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
method
required
string
The payment method, in this example it is authorize
gateway
required
string
This will always be manual for the manual payment gateway
200: OK
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "manual",
"gateway": "manual",
"amount": 100,
"currency": "USD",
"transaction-type": "authorize",
"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
Swift SDK
curl -X POST https://api.moltin.com/v2/orders/:orderId/payments \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"gateway": "manual",
"method": "authorize",
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X'
})
const orderId = 'XXXX'
const payment = {
gateway: 'manual',
method: 'authorize'
}
Moltin.Orders.Payment(orderId, payment).then(() => {
// Do something
})
let moltin = Moltin(withClientID: "<your client ID>")
let id = "XXXX"
let paymentMethod = ManuallyAuthorizePayment()
moltin.cart.pay(forOrderID: order.id, withPaymentMethod: paymentMethod) { (result) in
switch result {
case .success:
print("Success")
case .failure(let error):
print(error)
}
}

post
Capture transaction

https://api.moltin.com
/v2/orders/:orderId/transactions/:transactionId/capture
Request
Response
Path Parameters
transactionId
required
string
The UUID of the previously authorized transaction
orderId
required
string
The UUID of the order you want to capture for
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
method
required
string
The payment method, in this example it is capture
gateway
required
string
This will always be manual for the manual payment gateway
200: OK
{
"data": {
"id": "xxxxxxxx-xxxx-xxxx-xxxx-xxxxxxxxxxxx",
"type": "transaction",
"reference": "manual",
"gateway": "manual",
"amount": 100,
"currency": "USD",
"transaction-type": "capture",
"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"
}
}
}

The capture method requires client_credentials authentication.

cURL
JavaScript SDK
curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/transactionId/capture \
-H "Authorization: Bearer XXXX" \
-H "Content-Type: application/json" \
-d $'{
"data": {
"gateway": "manual",
"method": "capture"
}
}'
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const orderId = 'XXXX'
const transactionId = 'XXXX'
Moltin.Transactions.Capture({
order: orderId,
transaction: transactionId
}).then(() => {
// Do something
})