Charge Actions
Understand Affirm's charge actions
Overview
After creating a charge
, you can manage it through several key actions to keep your order management system up-to-date. These actions support various workflows such as processing payments, refunds, and cancelations.
Learn more about charge actions via our API Reference
- Includes request/response examples
- JSON-Object definitions
- Required attributes
Read Charge
With the Read Charge
API, you can use the charge_id
to retrieve checkout data and the status of a specific charge. Reading charge information is useful for keeping your order management system in sync with Affirm and ensuring records are up-to-date before taking further actions.
You can read single or multiple charges. Note that if you don't specify a charge_id
, the response includes a list of charges. You can define how the results are paginated using the limit
, before
, and after
query parameters.
// Read a single charge
curl https://sandbox.affirm.com/api/v2/charges/CHARGE_ID
-X GET
-u "public_key:private_key"
// Read multiple charges
curl https://sandbox.affirm.com/api/v2/charges/?limit=5&before=1234-ABCD
-X GET
-u "public_key:private_key"
Void
The Void Charge
API used along with the charge_id
cancels or deletes an authorized charge. It is often used when a customer cancels an order before it’s fulfilled. Voiding an authorized charge will:
- Permanently cancels a loan
- Notifies the user that the transaction was canceled
curl https://sandbox.affirm.com/api/v2/charges/CHARGE_ID/void
-X POST
-u "(public_api_key):(private_api_key)"
Refund
The Refund Charge
API allows you to issue a refund for the original purchase amount or a partial amount, similar to refunding a credit card transaction. Affirm automatically calculates all interest and fees corresponding to the refunded amount. For partial refunds, you can refund any amount as long as there is a positive balance remaining on the loan. Refunds can also be processed directly through the Merchant Portal.
Note: Once a loan has been fully refunded, it can not be reinstated.
curl https://sandbox.affirm.com/api/v2/charges/CHARGE_ID/refund \
-X POST
-u "(public_api_key):(private_api_key)"
-H "Content-Type: application/json"
-d '{"amount": 50000}'
Update
Use the Update Charge
API to update a charge with new fulfillment or order information, such as shipping_confirmation
, shipping_carrier
, or order_id
. Updated details are reflected in settlement reports, linking Affirm charges to your internal order IDs.
curl https://sandbox.affirm.com/api/v2/charges/CHARGE_ID/update
-X POST
-u "(public_api_key):(private_api_key)"
-H "Content-Type: application/json"
-d '{"order_id": "JLKM4321", "shipping_carrier": "USPS", "shipping_confirmation": "1Z23223", "shipping": {"name":{ "full": "John Doe"},"address": {"line1": "325 Pacific Ave", "state": "CA", "city": "San Francisco", "zipcode": "94111", "country": "USA"}}}'
Updated 24 days ago