Create Payment Transaction
By using this method, you can create a transaction. You need to send an API request to Gojek to create a transaction. Gojek processes the request and sends you the QR data. This QR data enables you to create the QR image and display it to the customer.
POST /integrations/payment/outlets/{outlet_id}/v2/transactions
Sample Request
curl -X POST https://api.sandbox.gobiz.co.id/integrations/payment/outlets/{outlet_id}/v2/transactions \
-H 'Content-Type: application/json' \
-H 'Idempotency-Key: string' \
-H 'Authorization: Bearer {access-token}' \
-d $'
{
"payment_type": "qris",
"transaction_details": {
"order_id": "order-1234",
"gross_amount": 3000,
"currency": "IDR"
},
"item_details": [
{
"id": "SKU-000123",
"price": 3000,
"quantity": 1,
"name": "Item sample no.1",
"brand": "sample brand",
"category": "others",
"merchant_name": null
}
],
"customer_details": {
"first_name": "John",
"last_name": "Doe",
"email": "[email protected]",
"phone": "+628111000123"
},
"metadata": {}
}
'
Path Parameters
JSON Attribute | Description | Type | Required |
---|---|---|---|
outlet_id | The Outlet ID where the transaction will be recorded. | String | Required |
Header Parameter
Name | Description | Type | Required |
---|---|---|---|
Idempotency-Key | It is used to identify whether the request is a new request or a retry request. Maximum Limit: 32 characters. | String | Required |
Idempotency Key
Gojek uses Idempotency-Key to safely handle the payment requests. The Idempotency-Key is in the form of a string, and it should be included in the request header. You can use any random string to create Idempotency-Key. The maximum allowed length of Idempotency-Key is 32 characters. When you send a request, Gojek server reads the Idempotency-Key to decide whether to return a previous response or to create a new transaction. Gojek ensures that the request for a payment transaction is processed only once for each Idempotency-Key. Gojek recycles idempotency keys after a month. So, you can reuse an idempotency key after a month of its creation.
Request Parameters
JSON Attribute | Description | Type | Required |
---|---|---|---|
payment_type | Payment method. | String | Required |
transaction_details | Details of a transaction. | Object | Required |
item_details | Details of an item. | Array(Object) | Optional |
customer_details | Details of a customer. | Object | Optional |
Sample Response - 201 Success
{
"success": true,
"data": {
"outlet": {
"id": "G000012345",
"pop_id": "fa6082ea-06da-4483-9c7e-eeb0447ed53e"
},
"transaction": {
"id": "71839e9c-944b-40ce-bd31-8a76db666f36",
"payment_type": "qris",
"status": "pending",
"qris_string": "00020101021226610014COM.GO-JEK.WWW01189360091430438058080210G7641517890303UMI51440014ID.CO.QRIS.WWW0215ID10190450190010303UMI5204581253033605802ID5907Circlek6015Bandung deket r61054025762470703A015036c98a2234-f6d1-46f6-91d3-2597ee7863bc5406122.0063044447",
"order_id": "order-1234",
"gross_amount": 3000,
"currency": "IDR",
"created_at": "2020-03-09T11:33:08Z",
"settlement_at": null
},
"actions": [
{
"name": "generate-qr-code",
"method": "GET",
"url": "https://api.sandbox.gobiz.co.id/transactions/71839e9c-944b-40ce-bd31-8a76db666f36/qr-code"
}
]
}
}
Response - 201 Success
JSON Attribute | Description | Type |
---|---|---|
success | Status of the request. Value true indicates successful submission of the request. | Boolean |
data | Details of transaction. | Object |
» outlet | Details of the outlet. | Object |
» transaction | Details of a transaction. | Object |
» actions | Action that can be performed for the transaction. | Array(Object) |
- To perform this operation, you must be authenticated using
go_auth_client_credentials(payment:transaction:write).
- Possible error responses are
401
,404
,406
, and415
. Please refer Error Glossary.