Lire, annuler, rembourser et mettre à jour les transactions
Découvrez les actions que vous pouvez entreprendre lorsque vous utilisez l'API Transactions d'Affirm. Découvrez comment lire, annuler, rembourser et mettre à jour une transaction.
Aperçu
After creating a transaction, you can manage it through various states and integrate each of the actions into your order management system, which is where you fulfill orders and/or process payments, refunds, and cancelations.
Lire
With the Read Transaction API, you can use the id returned from the transaction object to retrieve all checkout data and the transaction status of a specific transaction. Reading transaction information is useful for:
- Mettre à jour vos dossiers ou votre système de gestion des commandes en indiquant l'état actuel d'une transaction avant d'effectuer toute action sur celle-ci.
- Maintenir votre système en synchronisation avec Affirm si votre personnel gère manuellement les prêts dans le tableau de bord du commerçant.
You can read one or more transactions. When you don't specify an id, the response includes a list of transactions. You can define how the results are paginated using the limit, before, and after query parameters.
// Read a single transaction
curl https://sandbox.affirm.com/api/v1/transactions/id
-X GET
-u "public_key:private_key"
// Read multiple transactions
curl https://sandbox.affirm.com/api/v1/transactions/?limit=5&before=1234-ABCD
-X GET
-u "public_key:private_key"Annuler
Lorsque vous annulez une transaction autorisée, nous :
- Annulons définitivement le prêt.
- Avisons l'utilisateur que la transaction a été annulée.
To cancel or delete an authorized transaction, use the id associated with the transaction to void it. For example, this can occur when a user decides to cancel their order before it's fulfilled. Note that we can only void uncaptured loans.
curl https://sandbox.affirm.com/api/v1/transactions/id/void
-X POST
-u "(public_api_key):(private_api_key)"remboursement
Vous pouvez rembourser une transaction en fonction de l'achat d'origine, comme pour rembourser une transaction par carte de crédit. Affirm calcule automatiquement tous les intérêts et frais correspondant au montant remboursé.
Vous pouvez également rembourser une partie d'une transaction en spécifiant un montant précis. Pour les remboursements partiels, vous pouvez appliquer n'importe quel montant de remboursement tant que le solde du prêt est positif.
When a loan is fully refunded, it can’t be reinstated. You can refund the customer using the Refund Transaction request or the Merchant Dashboard.
curl https://sandbox.affirm.com/api/v1/transactions/id/refund
-X POST
-u "(public_api_key):(private_api_key)"
-H "Content-Type: application/json"
-d '{"amount": 20000}'Mettre à jour
You can use the Update Transaction request to update a transaction with new fulfillment or order information, such as shipping_confirmation, shipping_carrier, or order_id. Settlement reports associate your internal order IDs with specific Affirm transactions.
curl https://sandbox.affirm.com/api/v1/transactions/id/update
-X POST
-u "(public_api_key):(private_api_key)"
-H "Content-Type: application/json"
-d '{"order_id": "order_125", "shipping_carrier": "USPS", "shipping_confirmation": "C12345678901234", "shipping": {"name":{ "full": "John Doe"},"address": {"line1": "123 Example Street", "state": "CA", "city": "San Francisco", "zipcode": "94107", "country": "USA"}}}'Mis à jour about 2 months ago
USA
Canada