Simulate transaction clearing
Simulate transaction clearing in the Pay.com sandbox to test reconciliation logic and inspect IC++ fee data.
In the live environment, a transaction clears when Pay.com receives the acquirer's clearing data for it and books its final fees, such as interchange and network fees. Clearing creates the cash flow transaction that you use for reconciliation. See Reconciliation.
Pay.com's sandbox lets you simulate clearing so you can build and test your
reconciliation logic before going live. The simulate endpoint books dummy IC++
fees, clears the charge, and sends cashflow_transaction.created, as live
clearing does.
Supported resources
You can simulate clearing for charges only. The charge must already be
processed (approved or declined). Otherwise, the endpoint returns 422, or
404 for a charge that ended in an error. A charge can be cleared only once,
and a second call returns 400.
- 1
Create a charge in the sandbox
Create a charge in the sandbox. If you haven't done this before, follow the create a charge guide using the sandbox base URL:
https://api.sandbox.pay.com/v1/chargesTake note of the charge
id(chrg_…) in the response. You need it for the next step. - 2
Simulate clearing
Send a
POSTrequest to the simulate clearing endpoint, replacing{charge_id}with the ID from the previous step.curl -X POST https://api.sandbox.pay.com/v1/charges/{charge_id}/simulate/clear \ -u ':sk-pay-com-sandbox-…' \ --header 'Content-Type: application/json'The endpoint returns immediately and starts the clearing in the background. Within a few seconds, Pay.com:
- Books simulated fees for the transaction: a 0.30 gateway fee in your settlement currency, a 0.1% acquiring fee (approved charges only), and random network and interchange fees of up to 5% of the amount each.
- Clears the transaction, with today as its clearing date, making the data available in the reconciliation endpoint.
- Creates a
cashflow_transactionresource. - Sends a
cashflow_transaction.createdwebhook.
The cash flow transaction's ID is the charge's digits with the
cflw_tx_prefix. You can also wait for the webhook, or retrieve the charge and read itscashflow_transactionfield.Live clearing also adds the acquirer's network data, such as the ARN, to the charge, and sends
charge.updatedwhen it does. The simulator doesn't. - 3
Query the cash flow transaction
After clearing, you can query the cash flow transaction directly:
GET https://api.sandbox.pay.com/v1/cashflow/transactions/cflw_tx_{id}You can also listen for the
cashflow_transaction.createdwebhook event to receive the data automatically.The response contains the fee breakdown and the original charge. The simulator generates random fees and also books the gateway and acquiring fees, so your
feeandfee_breakdownvalues will differ from this example.{ "id": "cflw_tx_471314779009449984", "resource": "cashflow_transaction", "amount": 1200, "available_on": null, "created": "2024-07-24T13:56:45.136Z", "currency": "eur", "exchange_rate": null, "fee": -99, "fee_breakdown": [ { "amount": -30, "currency": "eur", "identifier": "charge", "type": "acquirer" }, { "amount": -1.2, "currency": "eur", "identifier": "charge", "type": "acquirer" }, { "amount": -41, "currency": "eur", "identifier": "network", "type": "network" }, { "amount": -27, "currency": "eur", "identifier": "interchange", "type": "interchange" } ], "net_amount": 1101, "net_amount_human_readable": "11.01", "source": { "id": "chrg_471314779009449984", "charge": { "id": "chrg_471314779009449984", "amount": 1200, "amount_human_readable": "12.00", "amount_refunded": 0, "billing_details": { "address": null, "email": null, "name": "123", "phone": null }, "calculated_statement_descriptor": "PAYCOM", "cashflow_transaction": "cflw_tx_471314779009449984", "created": "2024-07-24T13:56:45.136Z", "currency": "eur", "customer": null, "customer_reference_id": null, "description": null, "disputed": false, "failure_code": null, "failure_message": null, "fraud": false, "hold": null, "metadata": {}, "paid": false, "payment_method": "pm_card_471314801075683328", "payment_method_details": { "card": { "bin": "424242", "brand": "visa", "cardholder_currency": "usd", "country": "US", "exp_month": "11", "exp_year": "2025", "fingerprint": "37ec5c5745cf0ab6d2d7f9bf78d5d5ea14ae22db04a3bcfe80a3da6918e9b390", "funding": "debit", "last4": "4242", "name": "123", "network": "visa", "security_checks": { "address_line1_check": "unchecked", "address_postal_code_check": "pass", "cvc_check": "pass" }, "three_d_secure": null, "token": "tok_card_252811631061373952", "wallet": null }, "reference": null, "type": "card" }, "payment_method_options": { "card": { "accepted_card_brands": [], "accepted_card_categories": [], "accepted_card_countries": [], "accepted_card_funding": [], "accepted_card_jurisdictions": [], "accepted_eci_values": [], "request_threed_secure": "automatic", "security_checks": { "cvv_check": true } } }, "payment_session": null, "receipt": null, "reference": null, "refunded": false, "refunds": { "data": [], "url": "/v1/charges/chrg_471314779009449984/refunds" }, "resource": "charge", "shipping": null, "statement_descriptor_suffix": null, "status": "succeeded", "test_mode": true, "underlying_network_details": { "network": "visa", "visa": { "arn": "191262468630", "auth_code": "777637", "raw_response_code": "00" } }, "underlying_network_id": "651e3857-df71-4956-aff1-ba25d3a112f3", "underlying_processing_details": { "processor": "sandbox", "transaction_id": "062a89af-69c5-4062-9819-b8b90753279c" } }, "url": "/v1/charges/chrg_471314779009449984" }, "source_amount": 1200, "source_currency": "eur", "type": "charge" }
Key response fields
In the example, a €12.00 charge clears with €0.99 in fees, leaving €11.01.
| Field | Description |
|---|---|
amount | The original charge amount in the minor currency unit (the smallest unit). 1200 = €12.00. |
fee | Total fees deducted from the charge, rounded to the minor unit. -99 = €0.99 deducted. |
fee_breakdown | Itemized list of fees. Each entry includes the fee type (acquirer, network, or interchange), the amount, and the currency. Here the two acquirer entries are the €0.30 gateway fee and the 0.1% acquiring fee (-1.2, because breakdown amounts aren't rounded). |
net_amount | The amount after fees. 1101 = €11.01 from a €12.00 charge. |
source | The full original charge object, including payment method details, status, and network data. |
Next steps
- Webhook events: listen for
cashflow_transaction.createdto automate reconciliation. - Environments: understand the difference between the sandbox and live.
- Create a charge: create charges to test the clearing simulation flow.