Lock the terms of a refund
A refund is a plain USDC transfer from the merchant's own wallet to the wallet that paid. There is no refund contract, no relayer and no P2Flux custody in the path: P2Flux charges no refund fee, returns none of its original commission, and the merchant pays the gas.
Everything is derived from the chain. You supply identifiers and an integer amount - there is no field for a recipient anywhere in this API, because a refund endpoint that accepted one would be a withdrawal endpoint.
P2Flux keeps no refund history. It cannot tell you whether a payment was already refunded, and calling this twice will happily prepare two valid refunds. One refund per payment is your integration's rule to enforce, and the safe place is BEFORE this call: reserve the order row atomically, then prepare.
The returned refund_token is short-lived and for a browser only. Do not store it - reconciliation later goes through /v1/refunds/verify with the original settlement, which needs no token.
Request
- Base URL: https://api.p2flux.com
- URL: https://api.p2flux.com/v1/refunds/prepare
- Auth: none required
Request body
Example request
{
"tx_hash": "0x2d6bbc112885a6976289e599f71003f7d310e7152ebd662c6221dffd3e0da708",
"amount": "2500000"
}Response
Terms for the merchant's wallet to send.
Example response
{
"token": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
"merchant": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
"payer": "0xb4e43f3fBa5Add75395adAD366627E7d74141Fa9",
"original_amount": "10.00",
"original_amount_units": "2500000",
"refund_amount": "10.00",
"refund_amount_units": "2500000"
}Changes
No recorded changes to this operation across all 1 revision of this API.