The transaction object

Attributes
Sample Object

Attribute

Type

Description

id

string

The ID of the transaction

type

string

Always transaction

reference

string

The payment gateway reference

gateway

string

The name of the payment gateway used

amount

integer

The amount for this transaction

currency

string

The transaction currency

transaction-type

string

The type of transaction (purchase,capture, authorize or refund)

status

string

The status provided by the gateway for this transaction. complete or failed

relationships

object

This will contain the order object this transaction relates to

{
"data": [
{
"id": "03f634c3-9c70-4aa1-8178-f7d41a45d92z",
"type": "transaction",
"reference": "ch_1CVFEDCTrBHFHIc3NNG6EaFU",
"gateway": "stripe",
"amount": 40000,
"currency": "USD",
"transaction-type": "purchase",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "f6f63e5b-1e04-47aa-9213-993ead03d441"
}
}
}
}
]
}

get
Get all transactions

https://api.moltin.com
/v2/orders/:orderId/transactions
Request
Response
Path Parameters
orderId
required
string
The UUID of the order you require transactions for
Headers
Authorization
required
string
The Bearer token to grant access to the API
200: OK
{
"data": [
{
"id": "150ce9ca-c3a8-4214-b4f9-509987054cf4",
"type": "transaction",
"reference": "manual",
"gateway": "manual",
"amount": 50000,
"currency": "GBP",
"transaction-type": "capture",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "f7a70163-5878-48a8-97a3-1872178907aa"
}
}
}
},
{
"id": "1bcc324b-659c-40ba-81df-793f91298844",
"type": "transaction",
"reference": "",
"gateway": "stripe",
"amount": 50000,
"currency": "GBP",
"transaction-type": "purchase",
"status": "failed",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "f7a70163-5878-48a8-97a3-1872178907aa"
}
}
}
}
]
}
cURL
JavaScript SDK
curl -X GET https://api.moltin.com/v2/inventories/:orderId/transactions \
-H "Authorization: Bearer XXXX"
const MoltinGateway = require('@moltin/sdk').gateway
const Moltin = MoltinGateway({
client_id: 'X',
client_secret: 'X'
})
const id = 'XXXX'
Moltin.Orders.Transactions(id).then(transactions => {
// Do something
})

post
Authorize payment

https://api.moltin.com
/v2/orders/:orderId/payments
This endpoint is for those who wish to authorize payments using the manual gateway.
Request
Response
Path Parameters
orderId
required
string
The UUID of the order you wish to authorize payment for
Headers
Authorization
required
string
The Bearer token to grant access to the API
Body Parameters
method
required
string
Payment method to use
gateway
required
string
The type of gateway to use
200: OK
cURL
JavaScript 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'
Moltin.Orders.Payment(orderId, {
gateway: 'manual',
method: 'authorize'
}).then(() => {
// Do something
})

post
Capture payment

https://api.moltin.com
/v2/orders/:orderId/transactions/:transactionId/capture
Use this endpoint to capture a previously authorized payment. You will use this endpoint when you invoke the Manual Payments API.
Request
Response
Path Parameters
transactionId
required
string
The UUID of the transaction to capture
orderId
required
string
The UUID of the order
Headers
Authorization
required
string
The Bearer token to grant access to the API
200: OK
cURL
curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transaction_id/capture \
-H "Authorization: Bearer XXXX"

post
Refund payment

https://api.moltin.com
/v2/orders/:orderId/transactions/:transactionId/refund
You can mark a transaction as refunded. You will need to handle the actual refund on your side with your payment provider.
Request
Response
Path Parameters
transactionId
required
string
The UUID of the transaction you wish to refund
orderId
required
string
The UUID of the order
Headers
Authorization
required
string
The Bearer token to grant access to the API
200: OK
{
"data": {
"id": "78cf43c3-b8fa-4b84-9444-d2adf81ed8bd",
"type": "transaction",
"reference": "manual",
"gateway": "manual",
"amount": 59992,
"currency": "USD",
"transaction-type": "refund",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "a15894b0-7e6c-49e8-aad0-85b92e6501d4"
}
}
}
}
}

You will need to handle the actual refund with your payment provider

cURL
curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/refund \
-H "Authorization: Bearer XXXX"