Actions UK
Comprendre les actions de l'API Transactions d'Affirm.
Aperçu
After creating a transaction, you can manage it through various states and integrate each of these actions into your order management system 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 associated with a specific transaction. Reading transaction information is useful for updating your records or order management system with the current state of a transaction before performing any actions on it. It can also keep your system in sync with Affirm if your staff is manually managing loans in the merchant dashboard.
You can read single or multiple transactions. Note that if 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://api.global.sandbox.affirm.com/api/v1/transactions/id
-X GET
-u "public_key:private_key"
-H "country-code: GBR"
// Read multiple transactions
curl https://api.global.sandbox.affirm.com/api/v1/transactions/?limit=5&before=1234-ABCD
-X GET
-u "public_key:private_key"
-H "country-code: GBR"Annuler
Pour annuler ou supprimer une transaction autorisée, utilisez id associé à la transaction pour l'annuler. Par exemple, cela peut se produire lorsqu'un utilisateur décide d'annuler sa commande avant qu'elle ne soit exécutée. Notez que nous ne pouvons annuler que les prêts non capturés.
L'annulation d'une transaction autorisée effectue les opérations suivantes :
- Permanently cancels a loan.
- Notifies the user that the transaction was canceled.
curl https://api.global.sandbox.affirm.com/api/v1/transactions/id/void
-X POST
-u "(public_api_key):(private_api_key)"
-H "country-code: GBR"remboursement
Remboursez une transaction sur la base de l'achat initial, comme pour le remboursement d'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. Pour les remboursements partiels, vous pouvez appliquer n'importe quel montant de remboursement tant que le solde du prêt est positif.
Once a loan has been fully refunded, it can’t be reinstated. You can refund the customer using the Refund Transaction request or the Merchant Portal.
curl https://api.global.sandbox.affirm.com/api/v1/transactions/id/refund
-X POST
-u "(public_api_key):(private_api_key)"
-H "Content-Type: application/json"
-H "country-code: GBR"
-d '{"amount": 50000}'Mettre à jour
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://api.global.sandbox.affirm.com/api/v1/transactions/id/update
-X POST
-u "(public_api_key):(private_api_key)"
-H "Content-Type: application/json"
-H "country-code: GBR"
-d '{"order_id": "JLKM4321", "shipping_carrier": "Royal Mail", "shipping_confirmation": "1Z23223", "shipping": {"name":{ "full": "John Doe"},"address": {"street1": "9561 Queen Street","street2": "Apt 123", "city": "London", "postal_code": "N591FA","country": "GBR"}}}'
Mis à jour 3 months ago