instamoney docs

Fixed Virtual Accounts

Description

Fixed virtual accounts allow you to create unique 'fixed' virtual account numbers for all your users. This is particularly useful for users who need to send funds on a frequent basis, such as users with recurring subscriptions, as they can send funds to the same account number and still be unique identified by Instamoney.

If you choose to have virtual accounts assigned to a user, then a specific user will be given a lasting virtual account dedicated for your company. For example, Bob will always retain a BCA virtual account 02938-1234-567890 and it will always show Bob’s name when he tries to pay that virtual account. You have full control over the name that appears on the account when your users transfer money in.

Virtual account numbers are 15-digit account numbers that are generated from a defined range (ex. 02938-1001-111111). Instamoney supports virtual accounts for Mandiri, BRI, and BNI. We offer new customers 999,999 virtual account numbers to start. If you need more, please contact us!

Your customers can pay virtual accounts via ATM, mobile banking, and internet banking. Instamoney sends a callback each time this fixed virtual account is paid, so that your systems can be alerted automatically.

Try it now

Try out the Instamoney API in seconds below. Create your first fixed virtual account and see how you can easily get paid.

FIXED VIRTUAL ACCOUNT
PAYMENT
SUCCESS

Buat fixed virtual accounts (Create fixed virtual account)

Kami akan memulai dengan membuat fixed virtual account di BCA untuk Rika Sutanto.

Mari mulai dengan menjalankan permintaan curl di terminal Anda.

We will start by creating a fixed virtual account at BCA for Rika Sutanto.

Let’s start by running the curl request in your terminal.

 curl https://api.instamoney.co/callback_virtual_accounts -X POST \
      -u NIiHfL5xh+amlMdrKLZOTDSWYNGgodl6mXCy+Rxn/2TQ8LWnDgV1gQ==: \
      -d external_id=demo-1531960397057 \
      -d bank_code=BCA \
      -d name='Rika Sutanto' 

Implementing fixed virtual accounts

Follow the steps below to implement our API.

Go to Dashboard -> Settings -> Configurations -> Fixed Virtual Account, Click on Activate Button that available for every Banks. After you click it, you will get Fixed Virtual Account Ranges.

You’ll need to POST this request. It will create a fixed virtual account which your users can fund anytime. Learn more about the parameters in our API reference docs.

  • Curl
  • PHP
curl https://api.instamoney.co/callback_virtual_accounts -X POST \
      -u NIiHfL5xh+amlMdrKLZOTDSWYNGgodl6mXCy+Rxn/2TQ8LWnDgV1gQ==: \
      -d external_id=demo_virtual_account_1475459775872 \
      -d bank_code=BCA \
      -d name='Rika Sutanto'

We have prefilled the above example with a sample API key. If you're logged in, you'll see your specific test key. Only you can see this key.

Our fixed virtual account API will then return a response. We explain the response below

Response: 200

{
     "updated":"2016-10-07T01:35:46.658Z",
     "created":"2016-10-07T01:35:46.658Z",
     "owner_id":"57b4e5181473eeb61c11f9b9",
     "external_id":"demo-1475804036622",
     "bank_code":"BCA",
     "merchant_code":"02938",
     "name":"Rika Sutanto",
     "account_number":"029382548",
     "id":"57f6fbf26b9f064272622aa6"
     }
     
PARAMETER DESCRIPTION
id

Our unique ID for the fixed virtual account

owner_id

Your user ID

external_id

An ID of your choice we append to all transactions. Often your unique ID like a phone number, email or transaction ID.

merchant_code

The merchant code will be the prefix for the virtual account number, e.g 01234 your_number

account_number

This is the complete virtual account number (including the prefix). This works just like a bank account and is what a user will need to enter in their internet banking /ATM to send funds.

bank_code

Bank code for the relevant bank, e.g. BCA

When a payment is detected, we initiate a callback to notify you of an inbound payment. You’ll need to provide us a callback URL. Below we’ve included an example of what a callback client may look like from your side.

  • PHP
<?php
     if ($_SERVER["REQUEST_METHOD"] === "POST") {
     $data = file_get_contents("php://input");
     
     print_r("\n\$data contains the payment data \n\n");
     print_r($data);
     print_r("\n\nUpdate your database with the payment information \n\n");
     } else {
     print_r("Cannot ".$_SERVER["REQUEST_METHOD"]." ".$_SERVER["SCRIPT_NAME"]);
     }
     ?>
     

Verifying the callback virtual account

To verify if the callback you received is coming from us, you can GET this request.

  • Curl
curl https://api.instamoney.co/callback_virtual_account_payments/payment_id={payment_id} -X GET \
      -u NIiHfL5xh+amlMdrKLZOTDSWYNGgodl6mXCy+Rxn/2TQ8LWnDgV1gQ==: \
     

You can get your payment_id from the callback sent by Instamoney. Instamoney will then return a response below.

Response: 200

{
     "id": "598d91b1191029596846047f",
     "payment_id": "1502450097080",
     "callback_virtual_account_id": "598d5f71bf64853820c49a18",
     "external_id": "demo-1502437214715",
     "merchant_code": "77517",
     "account_number": "1000016980",
     "bank_code": "BCA",
     "amount": 5000,
     "transaction_timestamp": "2017-08-11T11:14:57.080Z"
     }
PARAMETER DESCRIPTION
id

ID of the callback virtual account payment

payment_id

Our internal system’s payment ID

callback_virtual_account_id

ID of the callback virtual account payment that was paid

external_id

External ID on the callback virtual account payment

merchant_code

5-digit merchant prefix to the full virtual account number

account_number

Account number of the virtual account

bank_code

Bank code of the virtual account number

amount

Amount that was paid to this virtual account payment

transaction_timestamp

Date time that the callback virtual account was paid

Congrats! That’s it - you’re now set to use fixed virtual accounts with Instamoney.

Next Steps

  • Ready to do some testing? Our testing pages walks through some testing so you can test your implementation

Questions?

Still have more questions? We're always happy to help however we can. Shoot us an email or chat to us in live chat.