One-Time Payment

1. Create a Payment

To start accepting payments on your website, app or platform, create a Payment object with the order details.

A Payment object captures the life cycle of a payment, keeping track of the history of payment attempts and flow of the payment's statuses.

# POST api/v4/payments
{
	"data": {
		"attributes": {
			"paymentMethodType": "retail_outlet",
			"amount": 100000,
      "currency":"IDR",
			"referenceId": "ORDER_0001",
			"expiredAt": "2020-10-20T09:12:48+07:00", // optional parameters
			"description": "Order Number 0001" // optional parameters
			// fill this object in accordance to the payment method of your choosing
			"paymentMethodOptions": {
				"retailOutletName": "ALFAMART",
				"displayName": "Nama Tampilan"
			}
		}
	}
}

2. Show payment instructions to your customers if any

This is a sample response you will get.

# Retail Outlet
{
    "data": {
        "id": "contract_ea9c4b10df49446eafd4fb3f25a713bd",
        "type": "payment",
        "attributes": {
            "status": "pending",
            "amount": "100000.0",
            "currency":"IDR",
            "createdAt": "2020-10-19T09:12:48+07:00",
            "description": null,
            "expiredAt": "2020-10-20T02:12:48Z",
            "referenceId": "ORDER_0001",
            "fees": "4400.0",
            // Show these payment instructions to your customers
            "paymentMethod": {
                "id": "871767762ccded4a92461ac0d3376c1e",
                "type": "retail_outlet",
                "referenceId": "ORDER_0001",
                "instructions": {
                    "retailOutletName": "ALFAMART",
                    "paymentCode": "8887322",
                    "displayName": "Nama Tampilan"
                }
            }
        }
    }
}

Some payment methods will require additional actions to be performed by your end-customers.

If so, the Payment response will include instructions that you should show your end-customers so that they know how to perform the additional actions required. For example, making a bank transfer through ATM, online bank transfer or paying over the counter at a retail outlet.

3. Get notified when payment has been made successfully

Once a payment has been made successfully, we will notify you with a callback. The payment's status will now be paid.

# Sample Callback
{
    "data": {
        "id": "contract_ea9c4b10df49446eafd4fb3f25a713bd",
        "type": "payment",
        "attributes": {
            "status": "paid", // Note the status is shown as "paid" at this step
            "amount": "100000.0",
          	"currency":"IDR",
            "createdAt": "2020-10-19T09:12:48+07:00",
            "description": null,
            "expiredAt": "2020-10-20T02:12:48Z",
            "referenceId": "ORDER_0001",
            "fees": "4400.0",
            "paymentMethod": {
                "id": "871767762ccded4a92461ac0d3376c1e",
                "type": "retail_outlet",
                "referenceId": "ORDER_0001",
                "instructions": {
                    "retailOutletName": "ALFAMART",
                    "paymentCode": "8887322",
                    "displayName": "Nama Tampilan"
                }
            }
        }
    }
}

Present the payment results to your customer, and you may now fulfill your order.

4. Get notified when funds are available for withdrawal or transfer

In most cases, funds may not be immediately available for withdrawal or transfer. We will notify you with a callback when funds have been made available. The payment's status will then be set to completed.