One-Time Payment

A Typical One-Time Payment Flow (i.e Payment Object)

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 the flow of the payment's statuses. Below is an example of calling a One-Time PayNow QRO API.

curl https://sandbox.xfers.io/api/v4/payments \
 --header 'content-type: application/vnd.api+json' \
 -u test_api_key:secret_key \
 -d '
{
  "data": {
    "attributes": {
      "amount": "0.1",
      "referenceId": "pennytest_1",
      "paymentMethodType": "paynow",
      "expiredAt": "2020-12-03T20:03:53+07:00",
      "paymentMethodOptions": {
        "merchantPrefix": "PHOHANOI"
      }
    }
  }
}

2. Show payment instructions to your customers if any.

This is a sample response you will get.

# Sample Response

{
    "data": {
        "id": "contract_e5855b3297304ec78b904bdb08ae1685",
        "type": "payment",
        "attributes": {
            "status": "pending",
            "amount": "0.1",
            "createdAt": "2020-12-03T17:19:15+08:00",
            "description": null,
            "expiredAt": "2020-12-03T20:03:53+07:00",
            "referenceId": "pennytest_1",
            "fees": "0.0",
            "paymentMethod": {
                "id": "paynow_5e9f826617f35e45ea3a1e5464ee28b4",
                "type": "paynow",
                "qrCodeDisplayImage": "iVBORw0KGgoAAAANSUhEUgAAAMMAAADDCAYAAAA/f6WqAAAABGdBTUEAALGPC/.../wNy78pYJ3AiFQAAAABJRU5ErkJggg=="
            }
        }
    }
}

3. Xfers will notify you 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_e5855b3297304ec78b904bdb08ae1685",
    "type": "payment",
    "attributes": {
      "status": "paid",
      "amount": "0.1",
      "createdAt": "2020-12-03T17:19:15+08:00",
      "description": null,
      "expiredAt": "2020-12-03T20:03:53+07:00",
      "referenceId": "pennytest_1",
      "fees": "0.0",
      "paymentMethod": {
        "id": "paynow_5e9f826617f35e45ea3a1e5464ee28b4",
        "type": "paynow",
        "qrCodeDisplayImage": "iVBORw0KGgoAAAANSUhEUgAAAMMAAADDCAYAAAA/f6WqAAAABGdBTUEAALGPC//wNy78pYJ3AiFQAAAABJRU5ErkJggg=="
      }
    }
  }
}

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

4. Xfers will further notify you when funds have been made available for you to withdraw or transfer.

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

Different Modes of Payment for One-Time Payment

Xfers has 2 solutions for One-Time Payment;

  1. Virtual Account
  2. PayNow QR

To call their respective APIs, kindly refer to our API Docs under Payments.


Did this page help you?