English
API ReferenceSign In

Testing

Last updated 09/20/2021

This section will explain how to simulate Retail Outlet transactions from creating Fixed Payment Code (FPC), making payments, and getting notifications / callbacks from successful transactions via the Retail Outlet API. For a guide to simulating a Retail Outlet with xenInvoice, please visit the following page.

Pre Testing

Make sure you have done the following steps before performing the simulation:

  1. Register Xendit account
  2. Make sure you have enabled the Retail Outlet payment method in your settings.
  3. You are in test mode and get your secret API key which you can generate from your dashboard. Please take a note that you need write access to be able to create an FPC.
  4. Download Postman and Xendit Collection. For further guidance about Postman, please visit the following article.
  5. Learn Retail Outlet API by visiting our API Reference.
  6. Once you've completed the steps above, you're ready to start testing!

Test 1: Creating Fixed Payment Code

For Retail Outlet ID

Send a POST request to https://api.xendit.co/fixed_payment_code using your secret API key. Enter the required and optional fields, as referenced in the API reference docs.

Example Request

{
    "external_id": "FPC-{{$timestamp}}",
    "retail_outlet_name": "ALFAMART",
    "name": "Ismail Rabbanii",
    "expected_amount": 25000
}

Example Response

{
    "is_single_use": false,
    "status": "ACTIVE",
    "owner_id": "5fd1c319b9986239d7ec5567",
    "external_id": "FPC-1619132067",
    "retail_outlet_name": "ALFAMART",
    "prefix": "TEST",
    "name": "Ismail Rabbanii",
    "payment_code": "TEST163412",
    "type": "USER",
    "expected_amount": 25000,
    "expiration_date": "2052-04-22T17:00:00.000Z",
    "id": "6081fea334850277649bc2a3"
}

For Retail Outlet/Over-the-Counter PH

Send a POST request to https://api.xendit.co/payment_codes using your secret API key. Enter the required and optional fields, as referenced in the API reference docs.

Example Request

{
    "reference_id": "123",
    "channel_code": "7ELEVEN",
    "customer_name": "Reinaldy Gultom",
    "amount": 50,
    "currency": "PHP",
    "market": "PH"
}

Example Response

{
    "id": "pcode-69196f15-4685-4d6e-84a4-234837e3237c",
    "business_id": "61359238d852f3401b86014d",
    "reference_id": "123",
    "customer_name": "Reinaldy Gultom",
    "payment_code": "PSTESTVG53A7FM",
    "currency": "PHP",
    "amount": 50,
    "channel_code": "7ELEVEN",
    "description": null,
    "is_single_use": true,
    "market": "PH",
    "status": "ACTIVE",
    "metadata": null,
    "created_at": "2021-09-06T05:04:17.052998115Z",
    "updated_at": "2021-09-06T05:04:17.052998115Z",
    "expires_at": "2021-09-08T05:04:17.016958771Z"
}

Test 2: Simulating Fixed Payment Code Payment

For Retail Outlet ID

Send a POST request to https://api.xendit.co/fixed_payment_code/simulate_payment using your secret API key.

You must first create the fixed payment code before executing this step. Be sure to use the same payment code that you created to simulate the payment.

Example Request

{
    "retail_outlet_name": "ALFAMART",
    "payment_code": "TEST163412",
    "transfer_amount": 25000
}

Example Response

{
    "status": "COMPLETED",
    "message": "Payment for the Fixed Payment Code was successfully simulated"
}

For Retail Outlet/Over-the-Counter PH

Send a POST request to https://api.xendit.co/payment_codes/simulate_payment using your secret API key.

Please note that: You must create the payment codes before you try to simulate the payment.

Example Request

{
  "payment_code": "PSTESTVG53A7FM",
  "channel_code": "7ELEVEN",
  "market": "PH",
  "reference": "random",
  "amount": 50,
  "currency": "PHP"
}

Example Response

{
    "id": "pymt-295e4d64-b7a5-4537-b5d4-4e558eb3dd91",
    "reference_id": "random",
    "payment_code": "PSTESTVG53A7FM",
    "amount": 50,
    "currency": "PHP",
    "remarks": "payment simulation",
    "created": "2021-09-06T05:24:29.579364458Z"
}

Test 3: Updating Fixed Payment Code

For Retail Outlet ID

Send a PATCH request to https://api.xendit.co/fixed_payment_code/{fixed_payment_code_id} using your secret API key. Enter the required and optional fields, as referenced in the API reference docs.

You can get the ‘id’ from the response sent in the create fixed payment code response

Example Request

{
    "name": "Ismail Rabbanii Update",
    "expected_amount": 28000
}

Example Response

{
    "is_single_use": false,
    "status": "ACTIVE",
    "owner_id": "5fd1c319b9986239d7ec5567",
    "external_id": "FPC-1619132067",
    "retail_outlet_name": "ALFAMART",
    "prefix": "TEST",
    "name": "Ismail Rabbanii Update",
    "payment_code": "TEST163412",
    "type": "USER",
    "expected_amount": 28000,
    "expiration_date": "2052-04-22T17:00:00.000Z",
    "id": "6081fea334850277649bc2a3"
}

For Retail Outlet/Over-the-Counter PH

Send a PATCH request to https://api.xendit.co/payment_codes/{payment_code_id} using your secret API key. Enter the required and optional fields, as referenced in the API reference docs.

Example Payment Code Detail

{
    "id": "pcode-dd901436-6c63-4fce-94f3-278edf265e42",
    "business_id": "61359238d852f3401b86014d",
    "reference_id": "TesT08",
    "customer_name": "Reinaldy",
    "payment_code": "PSTESTC7HBF9DG",
    "currency": "PHP",
    "amount": 50,
    "channel_code": "CEBUANA",
    "description": "this is test",
    "is_single_use": true,
    "market": "PH",
    "status": "ACTIVE",
    "metadata": null,
    "created_at": "2021-09-08T07:06:40.450295189Z",
    "updated_at": "2021-09-08T07:06:40.450295189Z",
    "expires_at": "2021-09-09T01:48:52Z"
}

Example Request

{
    "customer_name": "Albert",
    "expires_at": "2021-09-08T01:48:52Z"
}

Example Response

{
    "id": "pcode-dd901436-6c63-4fce-94f3-278edf265e42",
    "business_id": "61359238d852f3401b86014d",
    "reference_id": "TesT08",
    "customer_name": "Albert",
    "payment_code": "PSTESTC7HBF9DG",
    "currency": "PHP",
    "amount": 50,
    "channel_code": "CEBUANA",
    "description": "this is test",
    "is_single_use": true,
    "market": "PH",
    "status": "EXPIRED",
    "metadata": null,
    "created_at": "2021-09-08T07:06:40.450295Z",
    "updated_at": "2021-09-08T07:08:46.310392Z",
    "expires_at": "2021-09-08T01:48:52Z"
}

Test 4: Get Fixed Payment Code

For Retail Outlet ID

Sometimes you need to know the detail for your fixed payment code. You can use this endpoint by sending a GET request to https://api.xendit.co/fixed_payment_code/{fixed_payment_code_id}

Example Response

{
    "is_single_use": false,
    "status": "ACTIVE",
    "owner_id": "5fd1c319b9986239d7ec5567",
    "external_id": "FPC-1619132067",
    "retail_outlet_name": "ALFAMART",
    "prefix": "TEST",
    "name": "Ismail Rabbanii Update",
    "payment_code": "TEST163412",
    "type": "USER",
    "expected_amount": 28000,
    "expiration_date": "2052-04-22T17:00:00.000Z",
    "id": "6081fea334850277649bc2a3"
}

For Retail Outlet/Over-the-Counter PH

If you need to know the details of your payment code, you can use this endpoint by sending GET request to https://api.xendit.co/payment_codes/{payment_code_id}

Example Response

{
    "id": "pcode-4f6d78e5-add4-43ea-b9da-9e6c6ae4b9e7",
    "business_id": "61359238d852f3401b86014d",
    "reference_id": "Test",
    "customer_name": "Reinaldy",
    "payment_code": "PSTESTFWL22HMK",
    "currency": "PHP",
    "amount": 100,
    "channel_code": "7ELEVEN",
    "description": null,
    "is_single_use": true,
    "market": "PH",
    "status": "ACTIVE",
    "metadata": null,
    "created_at": "2021-09-06T07:00:29.049822Z",
    "updated_at": "2021-09-06T07:00:29.049822Z",
    "expires_at": "2021-09-08T01:48:52Z"
}