English
API ReferenceSign In

Testing

Last updated 05/05/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

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"
}

Test 2: Simulating Fixed Payment Code Payment

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

Note: 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"
}

Test 3: Updating Fixed Payment Code

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.

Note: 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"
}

Test 4: Get Fixed Payment Code

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"
}