The transaction object
Attributes Sample Object
Copy {
"data" : [
{
"id" : "03f634c3-9c70-4aa1-8178-f7d41a45d92z" ,
"type" : "transaction" ,
"reference" : "ch_1CVFEDCTrBHFHIc3NNG6EaFU" ,
"gateway" : "stripe" ,
"amount" : 40000 ,
"currency" : "USD" ,
"transaction-type" : "purchase" ,
"transaction_type" : "purchase" ,
"status" : "complete" ,
"relationships" : {
"order" : {
"data" : {
"type" : "order" ,
"id" : "f6f63e5b-1e04-47aa-9213-993ead03d441"
}
}
} ,
"meta" : {
"display_price" : {
"amount" : 40000 ,
"currency" : "USD" ,
"formatted" : "$400.00"
} ,
"created_at" : "2019-06-24T13:14:21.913Z" ,
"timestamps" : {
"created_at" : "2019-06-24T13:14:21.913Z" ,
"updated_at" : "2019-06-24T13:14:21.913Z"
}
}
}
]
}
Get all transactions
GET
https://api.moltin.com/v2/orders/:orderId/transactions
Path Parameters
200
Copy {
"data" : [
{
"id" : "015a3452-29a2-45b4-8b0d-0d697b224d45" ,
"type" : "transaction" ,
"reference" : "manual" ,
"gateway" : "manual" ,
"amount" : 19000 ,
"currency" : "USD" ,
"transaction_type" : "capture" ,
"status" : "complete" ,
"relationships" : {
"order" : {
"data" : {
"type" : "order" ,
"id" : "24f17926-af4b-439c-ae3c-13aa371bce77"
}
}
} ,
"meta" : {
"display_price" : {
"amount" : 19000 ,
"currency" : "USD" ,
"formatted" : "$190.00"
} ,
"timestamps" : {
"created_at" : "2018-12-17T16:19:53.379Z" ,
"updated_at" : "2018-12-17T16:19:53.379Z"
}
}
}
]
}
cURL JavaScript SDK
Copy curl -X GET https://api.moltin.com/v2/orders/:orderId/transactions \
-H "Authorization: Bearer XXXX"
Copy 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
})
Authorize payment
POST
https://api.moltin.com/v2/orders/:orderId/payments
This endpoint is for those who wish to authorize payments using the manual gateway.
Path Parameters
Request Body
cURL JavaScript SDK
Copy 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"
}
}'
Copy 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
})
Capture payment
POST
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. In this step you can also pass in a custom reference, such as the payment reference from your chosen gateway.
Path Parameters
Request Body
200
Copy {
"data": {
"id": "bcafac29-c8ca-4293-822c-d1213e085c7c",
"type": "transaction",
"reference": "manual",
"custom_reference": "my_custom_reference",
"gateway": "manual",
"amount": 60000,
"currency": "GBP",
"transaction_type": "capture",
"status": "complete",
"relationships": {
"order": {
"data": {
"type": "order",
"id": "239f104c-0b56-433c-a5f8-b73349196269"
}
}
},
"meta": {
"display_price": {
"amount": 60000,
"currency": "GBP",
"formatted": "£600.00"
},
"timestamps": {
"created_at": "2020-02-17T13:24:42Z",
"updated_at": "2020-02-17T13:24:45Z"
}
}
}
}
cURL
Copy curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transaction_id/capture \
-H "Authorization: Bearer XXXX"
Refund payment
POST
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.
Path Parameters
200
Copy {
"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
Copy curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/refund \
-H "Authorization: Bearer XXXX"
Confirm payment intent
POST
https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/confirm
Path Parameters
Request Body
200
Copy {
"data" : {
"id" : "b07c45c7-cd6d-466b-9ed9-bf44dd80696f" ,
"type" : "transaction" ,
"reference" : "pi_1FCnB5CTrBHFHKc35eHmhqnF" ,
"gateway" : "stripe_payment_intents" ,
"amount" : 5499 ,
"currency" : "USD" ,
"transaction_type" : "purchase" ,
"status" : "complete" ,
"payment_intent" : {
"client_secret" : "pi_1FCnB5CTrBHFHKc35eHmhqnF_secret_netgkKN9Cs9U4P98BG1T6esPa" ,
"status" : "requires_action"
} ,
"relationships" : {
"order" : {
"data" : {
"type" : "order" ,
"id" : "a37e7229-3539-4acb-95b9-9705da42d20e"
}
}
} ,
"meta" : {
"display_price" : {
"amount" : 5499 ,
"currency" : "USD" ,
"formatted" : "$54.99"
} ,
"timestamps" : {
"created_at" : "2019-08-29T12:56:39Z" ,
"updated_at" : "2019-08-29T12:56:43Z"
}
}
}
}
cURL
Copy curl -X POST https://api.moltin.com/v2/orders/:orderId/transactions/:transactionId/confirm \
-H "Authorization: Bearer XXXX" \
-d $'{
"data": {
"gateway": "stripe_payment_intents",
"method": "purchase",
"payment": "pm_card_threeDSecureRequired"
}
}'