Internet Banking

Internet banking enables customers of a bank to easily conduct financial transactions through a bank-operated website. In order to pay via internet Banking, the customer is required to have a registered account with their respective bank.

Registering for an account can be done online using an ATM or Debit Card, or offline at a branch.

The payment flow

Customers that choose to pay via internet banking go through a redirect payment flow. This means that they are redirected from the merchant's website to a secure bank-operated page in order to authorize and confirm the payment amount. Upon completion, the customer is automatically redirected back to the merchant's website.

internet banking 1

The customer selects internet banking as their preferred payment method and is redirected to the bank's page.

internet banking 2

Payment amount and reference numbers are already filled out. The customer only has to review the information and confirm the payment.

Creating a charge by using Payment Source

In order to create an offsite internet banking charge, you need to create source object by using the source api. The valid fields for type are internet_banking_bay, internet_banking_bbl, internet_banking_ktb and internet_banking_scb.

The following code demonstrates how to create source.

curl https://api.omise.co/sources \
  -X POST \
  -u skey_test_59rnqoboimgxvjk894d: \
  -d "amount=100000" \
  -d "currency=thb" \
  -d "type=internet_banking_scb"

JSON Response

{
  "object": "source",
  "id": "src_test_59sviq593cxd3zckpe0",
  "type": "internet_banking_scb",
  "flow": "redirect",
  "amount": 100000,
  "currency": "thb"
}

*Note that when creating source object, you can use either Secret Key or Public Key.

You will then get the result of creating source, the most important attribute is the id which will be used next. Lets assume you got src_test_59sviq593cxd3zckpe0 as an id.

To create a charge, pass it as source parameter in the charge api.

curl https://api.omise.co/charges \
  -X POST \
  -u skey_test_59rnqoboimgxvjk894d: \
  -d "amount=100000" \
  -d "currency=thb" \
  -d "return_uri=http://example.com/orders/345678/complete" \
  -d "source=src_test_59sviq593cxd3zckpe0"

return_uri - is the URI where the customer is redirected back to upon charge completion.

An example of JSON response is shown below.

{
  "object": "charge",
  "id": "chrg_test_59sviwaxncht3osj6fq",
  "livemode": false,
  "location": "/charges/chrg_test_59sviwaxncht3osj6fq",
  "amount": 100000,
  "currency": "thb",
  "description": null,
  "metadata": {
  },
  "status": "pending",
  "capture": true,
  "authorized": false,
  "reversed": false,
  "paid": false,
  "transaction": null,
  "refunded": 0,
  "refunds": {
    "object": "list",
    "from": "1970-01-01T00:00:00Z",
    "to": "2017-10-30T11:34:06Z",
    "offset": 0,
    "limit": 20,
    "total": 0,
    "order": null,
    "location": "/charges/chrg_test_59sviwaxncht3osj6fq/refunds",
    "data": [

    ]
  },
  "return_uri": "http://example.com/orders/345678/complete",
  "reference": "ofsp_test_59sviwaza3gh5ho98vb",
  "authorize_uri": "https://pay.omise.co/offsites/ofsp_test_59sviwaza3gh5ho98vb/pay",
  "failure_code": null,
  "failure_message": null,
  "card": null,
  "customer": null,
  "ip": null,
  "dispute": null,
  "created": "2017-10-30T11:34:06Z",
  "source": {
    "object": "source",
    "id": "src_test_59sviq593cxd3zckpe0",
    "type": "internet_banking_scb",
    "flow": "redirect",
    "amount": 100000,
    "currency": "thb"
  }
}

To proceed to the bank for payment, the merchant would need to redirect the customer to the authorize_uri.

*Note: In test mode, copy the URL returned in the authorize_uri and paste it to your browser to proceed with testing.

At any time the merchant can check the status of the charge by retrieving the charge as described in Charges API.

  • If both authorized and paid are true, the charge succeeded.
  • If both authorized and paid are false, the charge failed. For detailed explanation on the reason the charge failed, check the failure_code and failure_message in the Charge object. The Failure codes section below are the possible failure for internet banking.
  • There is no scenario where authorized or paid can have different values.

Charge Status

Status Description
successful The payee has successfully made payment (authorized = true and paid = true)
pending Awaiting action from the payee
expired The payee did not pay within 24 hours
failed The charge failed. You can check the reason from the failure_code and failure_message in the charge result.

Failure codes

Code Description
insufficient_balance There are not enough funds in the bank account for making a payment.
payment_cancelled Payment has been cancelled by payer.
timeout User did not take any action within 24 hours after charge was created.
failed_processing Payment failed due to other reasons.
bad_request The amount must be less than or equal to 4900000 (thb subunits)
bad_request Currency is currently not supported
bad_request type is currently not supported
bad_request invalid source
bad_request return_uri is required
not_found source source_id was not found

Webhooks

Rather than relying on the redirect back to the return_uri, we suggest merchants to make use of our Webhook API . Whenever a transaction is completed a webhook is sent to the URL that is specified in the dashboard with the event name charge.complete

Creating a charge by adding attribute source[type]

curl https://api.omise.co/charges \
  -X POST \
  -u skey_test_59rnqoboimgxvjk894d: \
  -d "description=Charge for order 3947" \
  -d "amount=100000" \
  -d "currency=thb" \
  -d "return_uri=http://example.com/orders/345678/complete" \
  -d "source[type]=internet_banking_scb"

By the way, charge can also create by adding attribute source[type] but we recommend to create charge by using payment source api.

Note

- Internet Banking is only available for merchants with a Thai-registered Omise account.

- For users with a live account, you will be required to review Terms & Conditions before using the live API.