Prerequisites
Before you begin this tutorial, ensure you’ve:- Obtained a Circle Mint sandbox API key with access to the Crypto Deposits API (stablecoin payins).
- Confirmed a completed stablecoin payin on the payment intent you want to refund.
- Confirmed there is no pending payment on that intent.
- Installed cURL for API calls.
Step 1: Start a refund on the payment intent
Call the Refund a payment intent endpoint.- Partial refund: set
toAmountto the amount you return to the customer. You can send multiple partial refunds up to what was settled. - Full refund: use the request fields for refunding the remaining balance as described in the API reference.
refund object with status pending and a refund
id.
Example request:
cURL
JSON
Step 2: Inspect the payment intent
Call Get a payment intent to confirm the refund is reflected on the intent. Expected result: the response includes these fields:amountRefunded: cumulative amount refunded on this intent so far.refundIds: refund IDs associated with this intent.paymentIds: IDs of payin payments on this intent.timeline: includes arefundedentry after the refund is recorded (alongside earlier statuses such aspaid).
cURL
JSON
Step 3: Confirm refund completion
Call Get a payment with the original payin paymentid or with the refund id from
Step 1.
Expected result: the response has type refund and status paid when
the refund has settled onchain.
If status is still pending, the refund has not finished. Poll
Get a payment on an interval,
or subscribe to payments notifications (see the
notifications quickstart)
to learn when the status changes.
Example request: (replace the ID with the payment or refund id)
cURL
JSON