Accepting BPI online banking payments

Accept BPI online banking payments using the Payment Intent workflow

Overview

BPI is one of the biggest banks in the Philippines. A BPI Online Banking user can use their account to authorize a debit of one of their bank accounts (either savings or current) to pay for a transaction.

Collecting BPI Online Banking payments starts with creating a resource to track a payment, having the customer authenticate the payment, and submitting the information to PayMongo for processing.

A Payment Intent resource is used to track and handle different states of the payment until it succeeds.

Our Payment Intents API handles these complexities:

  • Automatic authentication handling
  • No double charge of payment
  • Simplified Integration compared to Tokens API and Sources API

Payment Intent and Payment Method APIs

Use the Payment Intents API together Payment Methods API

1. Create a PaymentIntent from the Server Side

To start receiving payments with Payment Intents API, you must create one first. You must create your PaymentIntent from your backend using your secret API key then send the client_key and payment intent id of the response to the client-side. The payment intent id and client_key are used to attach a payment method to the payment intent. In this step, the payment intent's status is awaiting_payment_method.

2. Post the Payment Method Attachment

Once your customer selects BPI Online Banking as their payment method, you will need to create a PaymentMethod and attach it to the PaymentIntent. You must create your PaymentMethod from your frontend using your public API key and use the client_key to attach the payment method to the payment intent. A return_url must also be provided to define where the customer will be redirected after authentication (return_url is used after payment).

3. Have the customer authorize their account to finalize the payment

Once the Payment Method is attached, the Payment Intent status transitions to either awaiting_next_action, paid, or failed. You can check the status of the Payment Intent from the JSON response of the attach payment method endpoint.

awaiting_next_action means your customer must authorize limited use of their Online Banking account to finalize the payment. This requires your customers to log in through a BPI Online Banking URL in order to authorize limited access to BPI Partner API without exposing their credentials.

Once the user successfully logs in, the customer can complete the transaction through the PayMongo Online Banking Web. After completion of the steps, the Payment Intent status will to paid.

4. Monitoring PaymentIntents through webhooks

If you prefer to monitor the transition of the PaymentIntent from your backend, you could be notified for successful and failed payments by listening to payment.paid and payment.failed events by registering your webhook endpoint using our Webhook API.

🚧

Webhooks

You should not create a webhook in your code. You can try using API tools such as Postman or curl to create your webhook once. Please take note that you should not create multiple webhooks for every source that will be created. One webhook with events payment.paid and payment.failed is enough to receive the chargeable source information.

Event notifications will be sent to your registered webhook endpoint containing relevant payment information as shown below:

{
  "data": {
    "id": "evt_hgkWUxaVLx2A6nvKggTXLTYJ",
    "type": "event",
    "attributes": {
      "type": "payment.paid",
      "livemode": true,
      "data": {
        "id": "pay_ezTyGLeLd9vZUaLvoLV26edF",
        "type": "payment",
        "attributes": {
          "access_url": null,
          "amount": 10000,
          "balance_transaction_id": "bal_txn_UnBSeoKMUMwUVxfqEmyQc5wU",
          "billing": {
            "address": {
              "city": "Antipolo",
              "country": "PH",
              "line1": "B  8&9 ~`[email protected]#$%^&*()_+ lot",
              "line2": "12-=?<>,{}[]|\\werss st",
              "postal_code": "1870",
              "state": "Rizal"
            },
            "email": "[email protected]",
            "name": "Juan dela cruz",
            "phone": "09171111111"
          },
          "currency": "PHP",
          "description": "Dog Treats",
          "disputed": false,
          "external_reference_number": null,
          "fee": 1500,
          "livemode": true,
          "net_amount": 8500,
          "origin": "api",
          "payment_intent_id": "pi_9aPzjt6VDWpm39rrtzaw7hrj",
          "payout": null,
          "source": {
            "id": "dob_M3zpBRTWRsMUvEgDyBLri8yA",
            "type": "dob"
          },
          "statement_descriptor": "BarkerShop",
          "status": "paid",
          "tax_amount": null,
          "refunds": [],
          "taxes": [],
          "available_at": 1651741200,
          "created_at": 1651652950,
          "paid_at": 1651652946,
          "updated_at": 1651652951
        }
      },
      "previous_data": {},
      "created_at": 1651652952,
      "updated_at": 1651652952
    }
  }
}

You can determine if a payment is successful or not by checking the event type or the status of the payment intent.


Did this page help you?