Open Payment

Flow for Creating Payment Method

1. Create a Payment Method

To start accepting payments on your website, app or platform, you will need to create a Payment Method object that will help capture the payments made by your customers.

When creating a Payment Method object , make sure you bind it to one of your customers. This will ensure that you know who has made a payment when we notify you of a successful payment.

The payment method type is chosen as part of the URL of the API call.
Below, you'll be able to see an example of a Payment Method being created with the Virtual Account type.

# /api/v4/payment_methods/virtual_bank_accounts
{
  "data": {
    "attributes": {
      "bankShortCode": "BNI",
      "referenceId": "va_reference_id",
      "displayName": "Nama Tampilan",
      "suffixNo": "12345678"
    }
  }
}

Find out more about available Payment Methods.

2. Show payment instructions to your customer

When creating a payment method that will capture payments made by your customers, it is likely that you will need to show your customers instructions on how to make the payments.

The response of Payment Method created will include instructions that you should show to your end-customers. Do remind them that they will need to perform additional actions in order to complete the payment, for example making a bank transfer through ATM or online bank transfer.

{
  "data": {
    "id": "va_6f13f61a9a9e12281054db945d88f430",
    "type": "virtual_bank_account",
    "attributes": {
      "referenceId": "va_reference_id",
      // Show your customers the payment instructions below
      "instructions": {
        "bankShortCode": "BNI",
        "accountNo": "8848095712345678",
        "displayName": "Nama Tampilan"
      }
    }
  }
}

3. Xfers notifies you of successful payments

Once your customer has made a payment successfully, we will notify you with a successful payment callback.

{
  "id": "contract_0266212d3c744aceb5de0e48fa6d730b",
  "type": "payment",
  "attributes": {
    "status": "paid", // Note the status is shown as "paid" at this step
    "amount": "80000.0",
    "createdAt": "2020-08-14T14:32:33+07:00",
    "description": null,
    "expiredAt": null,
    "referenceId": "external_id_1a5fefff02",
    "fees": "3630.0",
    "paymentMethod": {
      "type": "virtual_bank_account",
      "referenceId": "va_reference_id",
      "instructions": {
        "bankShortCode": "BNI",
        "accountNo": "8848095712345678",
        "displayName": "Nama Tampilan"
      }
    }
  }
}

Note that the status of the payment should be paid.

At this point of time, you should be able to safely present the payment results to your customer, and you may now fulfill your order. However, the funds may not yet be available for withdrawal, or transfer.

4. Xfers notifies you when funds are available

Another callback will be fired to notify you when the funds for a successful payment is now available for transfer or withdrawal.

The status of the payment will now be completed.

{
  "id": "contract_0266212d3c744aceb5de0e48fa6d730b",
  "type": "payment",
  "attributes": {
    "status": "completed", // Note the status is shown as "completed" at this step
    "amount": "80000.0",
    "createdAt": "2020-08-14T14:32:33+07:00",
    "description": null,
    "expiredAt": null,
    "referenceId": "external_id_1a5fefff02",
    "fees": "3630.0",
    "paymentMethod": {
      "type": "virtual_bank_account",
      "referenceId": "va_reference_id",
      "instructions": {
        "bankShortCode": "BNI",
        "accountNo": "8848095712345678",
        "displayName": "Nama Tampilan"
      }
    }
  }
}

Did this page help you?