Overview
This document outlines how to initiate transactions using the Facilero Alternative Payment Methods (APM) API. The API supports various payment methods such as e-wallets, mobile wallets, bank transfers, and more. By using the provided endpoints, you can process payments and receive callbacks with transaction details.
API Endpoint
Live
POST https://api.facilero.com/api/v1/payments/apmSandbox
POST https://sandbox.facilero.com/api/v1/payments/apmRequest Headers
Content-Type: application/jsonAuthorization: Bearer <AUTH_TOKEN>- Replace<AUTH_TOKEN>with the actual token obtained from the Authorization Service.Referer: <REFERER_URL>- Replace<REFERER_URL>with the relevant referring URL.
Request Body
Fields
| Field | Type | Required | Description |
|---|---|---|---|
requestId | String | Yes | Unique identifier for the payment request. |
accountId | String | Yes | Merchant account ID to which the transaction will be associated. |
apmPayload | Object (ApmPayload) | Yes | Contains payment method-specific details. Refer to the specific documentation for each payment method for the exact payload structure required. |
amount | String | Yes | Transaction amount as a string. Follow currency precision rules. |
currency | String | Yes | ISO 4217 currency code (e.g., USD, EUR). |
metadata | Map<String, String> | No | Additional key-value metadata for custom use. |
order | Object (Order) | Yes | Contains order information (see Order Object). |
billingDetails | Object (ApmBillingDetails) | Yes | Contains billing details such as name, address, and contact info. |
device | Object (Device) | Yes | Contains device information for risk assessment. |
callbackUrl | String | No* | URL to receive transaction status updates. |
successRedirectUrl | String | No* | URL to redirect the customer after a successful payment. |
failureRedirectUrl | String | No* | URL to redirect the customer after a failed payment. |
checksum | String | Yes | HMAC-SHA256 signature used to verify request integrity. See |
ApmBillingDetails Object
| Field | Type | Required | Description |
|---|---|---|---|
externalUserId | String | No* | External identifier for the user. |
firstName | String | No* | Customer's first name. |
lastName | String | No* | Customer's last name. |
address1 | String | No* | First line of the billing address. |
city | String | No* | City of the billing address. |
state | String | No* | State/province of the billing address. |
country | String | No* | Country code in ISO Alpha-2 format (e.g., US, GB). |
postalCode | String | No* | Postal/ZIP code. |
phone | String | No* | Customer's phone number. |
email | String | No* | Customer's email address. Must be a valid email format. |
dateOfBirth | String | No* | Customer's date of birth. |
ssn | String | No* | Customer's social security number (if applicable). |
identityCode | String | No* | Customer's national ID or other government-issued identity code. |
Note: Fields marked with No* are not required by default, but may be required for specific payment methods. Please consult the APM-specific documentation to determine which fields are required for your chosen payment method.
Device Object
| Field | Type | Required | Description |
|---|---|---|---|
deviceId | String | No* | Unique identifier for the device. |
fingerprintData | String | No* | Device fingerprint information. |
ip | String | Yes | IP address of the customer's device. |
accept | String | No* | HTTP Accept header from the browser. |
acceptLanguage | String | No* | HTTP Accept-Language header from the browser. |
acceptHeader | String | No* | Full Accept header information. |
userAgent | String | No* | Browser's User-Agent string. |
javaEnabled | Boolean | No* | Whether Java is enabled in the browser. |
javaScriptEnabled | Boolean | No* | Whether JavaScript is enabled in the browser. |
deviceLanguage | String | No* | Language setting of the device. |
colorDepth | String | No* | Color depth of the device screen. |
screenHeight | String | No* | Screen height in pixels. |
screenWidth | String | No* | Screen width in pixels. |
deviceTimezone | String | No* | Timezone setting of the device. |
Note: Fields marked with No* are not required by default, but may be required for specific payment methods. Please consult the APM-specific documentation to determine which fields are required for your chosen payment method.
Order Object
| Field | Type | Required | Description |
|---|---|---|---|
date | String | No* | Date when the order was created. |
orderId | String | No* | Unique identifier for the order. |
title | String | No* | Title or description of the order. |
siteId | String | No* | Identifier for the site where the order was placed. |
name | String | No* | Name associated with the order. |
domainName | String | No* | Domain name of the website where the order was placed. |
Note: Fields marked with No* are not required by default, but may be required for specific payment methods. Please consult the APM-specific documentation to determine which fields are required for your chosen payment method.
Response
Response Object
| Field | Type | Description |
|---|---|---|
requestId | String | The original request ID from the request. |
transactionId | String | Unique identifier for the transaction. |
transactionStatus | Enum (TxStatus) | Status of the transaction (PENDING, COMPLETED, DECLINED, etc.). |
declineCode | Integer | Error code if the transaction was declined. |
declineSubReason | String | Additional details on why the transaction was declined. |
apmResponseData | Object (ApmResponseData) | Payment method-specific response data. Contains information needed for the next steps of the payment flow. |
createdTime | String | Timestamp indicating when the transaction was created. |
ApmResponseData Object
The apmResponseData field contains payment method-specific response data necessary for completing the payment flow:
| Field | Type | Description |
|---|---|---|
paymentMethod | Enum (PaymentMethod) | The payment method used (PAYPAL, IDEAL, GOOGLE_PAY, APPLE_PAY, ExPay). |
paymentType | Enum (PaymentType) | Type of payment flow (BANK_TRANSFER, CARD_PAYMENT, E_WALLET, etc.). |
redirectUrl | String | Optional URL to redirect the customer to complete the payment. Will be provided for redirect-based payment flows. |
iframeUrl | String | Optional URL to load in an iframe for payment completion. Used for iframe-based payment flows. |
providerTransactionId | String | Optional transaction ID from the APM provider's system. |
Note: Different payment methods might have additional fields specific to their implementation.
Callback
After processing, the transaction result will be sent to the callbackUrl specified in the request. The callback uses the ApmPaymentTxInfoDto object format with the following structure.
In addition, Facilero includes a checksum header to ensure callback authenticity. See the Checksum Authentication Guide for details.
Callback Headers
| Header | Type | Description | Fields Used for Checksum | |||
|---|---|---|---|---|---|---|
X-Checksum | String | HMAC-SHA256 checksum for the callback. Based on | accountId | amount | currency | transactionId`. |
Callback Data Object (ApmPaymentTxInfoDto)
| Field | Type | Description |
|---|---|---|
transactionId | String | Unique identifier for the transaction. |
requestId | String | The original request ID from the request. |
accountId | Long | Merchant account ID. |
transactionStatus | Enum (TxStatus) | Status of the transaction. |
declineCode | Integer | Error code if the transaction was declined. |
declineSubReason | String | Additional details on why the transaction was declined. |
orderCurrency | String | Original currency of the order. |
processedCurrency | String | Currency in which the transaction was processed. |
orderAmount | Double | Original amount of the order. |
processedAmount | Double | Amount in which the transaction was processed. |
conversionRate | Double | Exchange rate used for currency conversion, if applicable. |
apmRequestPayload | Object (ApmPayload) | The original payment method payload sent in the request. |
apmResponseData | Object (ApmResponseData) | Payment method-specific response data. Refer to the specific documentation for each payment method |
callbackUrl | String | The callback URL specified in the request. |
successRedirectUrl | String | The successfull URL specified in the request. |
failureRedirectUrl | String | The failure URL specified in the request. |
billingDetails | Object (ApmBillingDetails) | Billing details from the original request. |
order | Object (Order) | Order information from the original request. |
createdAt | String | Timestamp indicating when the transaction was created. |
Example Request (ExPay E-Wallet)
{
"requestId": "req-123456789",
"accountId": "12345",
"apmPayload": {
"paymentMethod": "ExPay",
"paymentType": "E_WALLET",
// Additional ExPay-specific fields
},
"amount": "100.00",
"currency": "USD",
"callbackUrl": "https://merchant.example.com/callbacks/payments",
"billingDetails": {
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]",
"phone": "+1234567890",
"address1": "123 Main St",
"city": "New York",
"state": "NY",
"country": "US",
"postalCode": "10001"
},
"order": {
"orderId": "order-123456",
"description": "Payment for services",
"items": [
{
"name": "Service A",
"quantity": 1,
"price": "100.00"
}
]
},
"metadata": {
"customField1": "value1",
"customField2": "value2"
}
}Example Response
{
"requestId": "req-123456789",
"transactionId": "tx-987654321",
"transactionStatus": "PENDING",
"apmResponseData": {
"paymentMethod": "ExPay",
"paymentType": "E_WALLET",
"redirectUrl": "https://pay.ExPay.example.com/checkout/tx-987654321",
"providerTransactionId": "ExPay-tx-12345"
},
"createdTime": "2023-01-01T12:00:00Z"
}Example Callback Data
{
"transactionId": "tx-987654321",
"requestId": "req-123456789",
"accountId": 12345,
"transactionStatus": "COMPLETED",
"declineCode": null,
"declineSubReason": null,
"orderCurrency": "USD",
"processedCurrency": "USD",
"orderAmount": 100.0,
"processedAmount": 100.0,
"conversionRate": 1.0,
"apmRequestPayload": {
"paymentMethod": "ExPay",
"paymentType": "E_WALLET",
// Original request payload
},
"apmResponseData": {
"paymentMethod": "ExPay",
"paymentType": "E_WALLET",
"redirectUrl": "https://pay.ExPay.example.com/checkout/tx-987654321",
"providerTransactionId": "ExPay-tx-12345"
},
"callbackUrl": "https://merchant.example.com/callbacks/payments",
"billingDetails": {
// Original billing details
},
"order": {
// Original order details
},
"createdAt": "2023-01-01T12:00:00Z"
}Additional API Endpoints
Additional API Endpoints
Get Payment Information
Retrieve detailed information about a specific transaction.
GET https://live.facilero.com/api/v1/payments/apm/info/{id}Parameters
| Parameter | Type | Required | Description |
|---|---|---|---|
id | Long | Yes | The transaction ID to retrieve information for. |
Response
Returns a JSON object containing detailed payment information in the ApmPaymentTxInfoDto format or an error message if the transaction is not found.
Payment Flow
-
Initiate Payment: Send a request to the APM API endpoint with the required payment details.
-
Process Response:
- For redirect-based flows: Redirect the customer to the URL provided in
apmResponseData.redirectUrl. - For iframe-based flows: Load the URL from
apmResponseData.iframeUrlin an iframe.
- For redirect-based flows: Redirect the customer to the URL provided in
-
Receive Callback: Once the payment is completed, a callback will be sent to the provided
callbackUrlwith the final transaction status and details. -
Verify Status: You can also verify the transaction status by querying the
/info/{id}endpoint.
Error Handling
The API uses standard HTTP status codes to indicate the success or failure of requests:
200 OK- Request successful400 Bad Request- Invalid request parameters401 Unauthorized- Authentication failure404 Not Found- Resource not found500 Internal Server Error- Server-side error
Error responses include a descriptive message to help diagnose the issue.
⚠️ Important Note on Amount Formatting
In requests, the amount field is provided as a string (e.g., "200.00").
In callbacks, the amount field is returned as a double (e.g., 200.0).
Because Facilero uses native numeric types internally, trailing zeros after the decimal point may not be preserved. This means:
- Request →
"200.00" - Callback →
200.0
When generating or validating the checksum for callbacks, always use the exactamount value as provided in the callback payload, not the original request value.
This ensures checksum validation remains consistent and avoids mismatches caused by formatting differences.
Notes
- All monetary values should be passed as strings to maintain precision.
- The API supports different payment methods and flow types through the polymorphic
apmPayloadfield. - Always ensure proper validation of user inputs before submitting payment requests.
- The callback mechanism ensures you receive updates about transaction status changes.
- The
apmResponseDataobject is crucial for completing the payment flow, as it contains the necessary redirection URLs or iframe URLs depending on the payment method.
