How to process a 30-day card preauthorization
Introduction
This how-to guide will show you how to preauthorize funds on a card for 30 days and then debit the payment. The 30-day preauthorization feature gives flexibility for several use cases, and this guide shows you each of them.
Learn more about deposit preauthorizations →
Prerequisites
- A
ClientId
and an API key – if you don’t have these, contact Sales to get access to the Mangopay Dashboard - A User object created for your end user, and their associated Wallet
- A registered card (CB, Visa, or Mastercard), which is
VALID
or registered less than 24 hours ago, to make the payments - The URL of a page on your platform to return the end user to after authentication
1. Secure the funds
Create a deposit preauthorization to hold funds for 30 days.
Make the request
POST /v2.01/{ClientId}/deposit-preauthorizations/card/direct
In the information returned, retain the Id
of the Deposit Preauthorization for the next steps.
Redirect the user to 3DS protocol (if required)
Redirect the user to the SecureModeRedirectURL
value to complete strong customer authentication, unless it is null
. If SecureModeRedirectURL
is null
, this means that 3DS is not required and no redirection is needed.
You can also use the SecureModeNeeded
boolean to determine this redirection behavior.
For more information on how to handle 3DS redirection, see Steps 4, 6, and 7 of the How to process a card payment guide.
2. Use the deposit preauthorization
Once the Deposit Preauthorization’s PaymentStatus
is WAITING
, you can use the hold on the funds in a number of ways.
Set up webhook notifications for the following event types in order to be notified when a deposit preauthorization is ready to use, or when it has expired and can no longer be used:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_WAITING
- DEPOSIT_PREAUTHORIZATION_PAYMENT_EXPIRED
There are 3 ways you can use a Deposit Preauthorization and, if it won’t be used, you can cancel it manually to release the preauthorized funds for the user.
- A. Full or partial capture without complement
- B. Full capture with complement
- C. No-show with complement
- D. Cancel
In the following calls, use the Id
of the Deposit Preauthorization obtained previously as the DepositId
.
Caution - All actions must be taken within 30 days
Any captures or complements must be requested within 30 days, whether or not they are preceded by a capture or no-show.
A. Full or partial capture without complement
This option involves only one step:
- Capture the preauthorized funds either in full or partially
Note - Multiple captures not possible
Capturing the preauthorized amount (without a complement) can only be done once. It is possible to do a partial capture (for an amount less than the preauthorized amount).
To capture the preauthorized funds without taking advantage of the complement feature, use the dedicated Create a Deposit Preauthorized PayIn without complement endpoint.
Specify the Amount
values of debited funds and fees. The amount of the DebitedFunds
must be less than or equal to the preauthorized amount.
POST /v2.01/{ClientId}/payins/deposit-preauthorized/direct/full-capture
If the preauthorized pay-in is successful, the deposit preauthorization’s PaymentStatus
becomes VALIDATED
. In the PayinsLinked
parameter, the Id
of the capture is linked as the PayinCaptureId
.
You can set up a webhook for the following event type to be notified of the status change:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_VALIDATED
Use the View a Deposit Preauthorization endpoint to see these details.
Once the PaymentStatus
is VALIDATED
, no further action is possible.
B. Full capture with complement
This option is a two-step process:
- Capture the full amount of the preauthorized funds
- Capture the complement
Note - Partial capture not possible
Capturing part of the initially preauthorized amount is not possible if it is followed by a complement.
To capture the preauthorized funds and also capture an additional amount as a complement, use the dedicated Create a Deposit Preauthorized PayIn prior to complement endpoint.
POST /v2.01/{ClientId}/payins/deposit-preauthorized/direct/capture-with-complement
If the preauthorized pay-in is successful, the deposit preauthorization’s PaymentStatus
becomes TO_BE_COMPLETED
. In the PayinsLinked
parameter, the Id
of the capture is linked as the PayinCaptureId
.
You can set up a webhook for the following event type to be notified of the status change:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_TO_BE_COMPLETED
Use the View a Deposit Preauthorization endpoint to see these details.
To capture the complement, use the dedicated Create a Deposit Preauthorized PayIn complement endpoint:
After a successful pay-in complement, the deposit preauthorization’s PaymentStatus
becomes VALIDATED
. In the PayinsLinked
parameter, the Id
of the complement is linked as the PayinComplementId
.
You can set up a webhook for the following event type to be notified of the status change:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_VALIDATED
Use the View a Deposit Preauthorization endpoint to see these details.
Once the PaymentStatus
is VALIDATED
, no further action is possible.
C. No-show with complement
This option is a two-step process:
- Request a no-show, indicating that the preauthorized funds were not used
- Capture a complement, for example as a penalty or other service charge
To request a no-show, change the PaymentStatus
to NO_SHOW_REQUESTED
.
If the request is successful, the PaymentStatus
in the response is NO_SHOW
.
You can set up a webhook for the following event types to be notified of the status changes:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_NO_SHOW_REQUESTED
- DEPOSIT_PREAUTHORIZATION_PAYMENT_NO_SHOW
To capture the complement, use the dedicated Create a Deposit Preauthorized PayIn complement endpoint.
POST /v2.01/{ClientId}/payins/deposit-preauthorized/direct/complement
After a successful pay-in complement, the deposit preauthorization’s PaymentStatus
becomes VALIDATED
. In the PayinsLinked
parameter, the Id
of the complement is linked as the PayinComplementId
.
You can set up a webhook for the following event type to be notified of the status change:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_VALIDATED
Use the View a Deposit Preauthorization endpoint to see these details.
Once the PaymentStatus
is VALIDATED
, no further action is possible.
D. Cancel
If the Deposit Preauthorization won’t be used, either to capture the preauthorized funds or a complement, you can release the preauthorized funds by changing the PaymentStatus
to CANCELED
.
Once the PaymentStatus
is CANCELED
, no further action is possible.
You can set up a webhook for the following event types to be notified of the status changes:
- DEPOSIT_PREAUTHORIZATION_PAYMENT_CANCEL_REQUESTED
- DEPOSIT_PREAUTHORIZATION_PAYMENT_CANCELED