Finalize a Card
Utilisez la requête de finalisation de l'API de carte d'Affirm pour rembourser le solde inutilisé restant sur la carte virtuelle.
Aperçu
If a merchant does not capture the authorized loan amount from a virtual card in full or issues a partial refund, Affirm will wait through an “auth window” (45 days by default) for the merchant to resolve open authorizations. However, this means that the customer must also wait the full authorization window before receiving their refund.
L'API Finalize est un signal affirmatif du commerçant indiquant qu'il a terminé d'effectuer des actions sur la carte virtuelle.
Affirm recommends to call the finalize API on the virtual card at least 1 week after the last anticipated capture is submitted to the card. Finalizing the card improves the user experience by ensuring that your customers receive a timely refund.
Note:
Once you finalize the virtual card, it would not be able to accept further authorizations and capture.
Comment ça fonctionne
The Finalize API resolves an authorized or captured loan down to the amount that has been captured on the Affirm virtual card at the moment of the API request execution.
- If no funds have been captured, the loan will be voided/canceled.
- If any funds have been captured, the loan will be refunded down to the amount that is outstanding (including a full refund, if the card has been fully refunded).
Note:
If you are unsure if the specifications listed above apply to your business, please contact us via the support widget.
Implémentation
Make sure that you only hit the Finalize API 1 week after you have captured all existing authorizations and have no intention of further authorizations/captures on the card.
- If there is an order cancellation, make sure everything has been captured on the card even if that is lower than the order total.
- If you still wish to capture on the card, do not hit the Finalize API yet. You can call the Finalize API when you are done capturing.
Note:
Veuillez noter que l'unique événement qu'Affirm attend après la finalisation de la carte est un remboursement.
Étape 1
[Example] Run a query to return orders that need to be finalized
Commandes de rétrospection pour lesquelles la dernière capture a eu lieu il y a 7 jours :
SELECT order_id, transaction_id FROM customer_orders
WHERE payment_type = 'Affirm'
AND order_status = 'fully captured' -- check notes below on order status
AND finalized_status = 0
AND last_capture_date <= DATEADD(day, -7, current_date)
Note on
order status
:The exact definition of a “fully captured” order will depend on your business logic. The core idea is that there are no funds remaining to be captured for the order. E.g.: this would both count for “happy path” orders where 100% of the funds are captured and partial cancellations where, for instance, 60% was captured, and the remaining 40% was canceled; in this case, 100% of the funds that need to be captured are already captured, so the Finalize API can be hit.
Étape 2
Appelez l'API Finalize sur ces commandes
Avec les identifiants de paiement Affirm associés aux commandes, effectuez un appel POST
vers notre point de terminaison Finalize :
https://api.global.affirm.com/api/v2/cards/{checkout_id}/finalize
Example of a successful response:
{
"message": "The card was successfully scheduled to finalize. You should see changes reflected in 24 hours.",
"code": "success",
"checkout_token": "FA0UUFRGOND84S7C"
}
Order flow diagrams
Multi-item refund
Multi-item partial refund
Chronologie
Successful response
Une fois la réponse de confirmation reçue, le prêt du client sera remboursé partiellement ou totalement.
- Si la carte est dans les états expiré, annulé ou auth_expired, ne rien faire.
- Si la carte est dans un état confirmé, expirez la carte et annulez la transaction.
- Si la carte est dans un état autorisé, l’autorisation expire la carte et annule la transaction.
- If the card is in captured state, auth expire the card and refund the charge to the balance that is currently captured on the card.
Once the scheduled event is executed, this will either remove the loan from the customer's Affirm user portal or refund and update the payment schedule for the loan to the appropriate amount.
Bad request
- The merchant is not a Platforms vcn merchant.
- There is no checkout token associated with that
checkout_token
.- Il n’y a pas de carte associée au
checkout_token
.- The current agent does not have update permission on the charge (wrong merchant).
- The charge is being disputed.
- L'état de la carte n'est pas géré (cela ne devrait jamais se produire, sauf si nous ajoutons un nouvel élément
CardState
).Only practically available in the production environment. Needs to hit the payment rails.
Mis à jour il y a environ 1 an