OWNER) requests to access their Mangopay Account, they must authenticate using SCA.
Scope
Mangopay Account access can be considered as:- Viewing a wallet balance
- Requesting a list of transactions crediting or debiting a wallet
OWNER users. SCA is required on first-time access and if more than 180 days have passed since the last SCA authentication for account access.
SCA applies even if a wallet is empty and its balance is zero (and even if there have never been funds in it). SCA also applies to a request to list transactions even if no transactions have ever taken place (the list is empty) or all the transaction requests were not successful.
Note – Multiple wallets considered same accountAll the wallets held by a single
OWNER user are considered to be part of their Mangopay Account. This means that SCA only has to be done once to access any of the user’s wallets.Endpoints impacted
For wallets, the following two endpoints (only) are in scope because they are considered to be accessing the balance of a wallet: The endpoints to create and update wallets will not be affected by SCA. For transactions, the following two endpoints (only) are in scope because they are considered to be accessing the account’s transaction history: The endpoints to list transactions or refunds based on other objects (such as for a mandate, card, dispute, etc.) will not be affected by SCA.Action required
1. Send ScaContext on Owner-initiated wallet access requests
On the 4 endpoints listed above (only), your platform must send theScaContext query parameter on all requests for users whose UserCategory is OWNER.
The ScaContext parameter has the values:
USER_PRESENT– The user is taking the SCA-triggering action of accessing their wallet. The platform must redirect the user using thePendingUserAction.RedirectUrlreturned so that the user can complete the SCA session (unless exempted because a successful SCA session for wallet access occurred in the last 180 days, so no redirection link was returned).USER_NOT_PRESENT– The platform is taking the action under proxy from the user and the user has previously given consent to Mangopay (via the SCA hosted experience) to allow the action. If the user has not given (or has revoked) their consent, thenUSER_NOT_PRESENTreturns a 403 error.
ScaContext parameter should be considered mandatory and the relevant value must be sent on all wallet access requests for OWNER users. You do not need to send ScaContext if the UserCategory is PAYER.
USER_NOT_PRESENT requires proxy
To use theUSER_NOT_PRESENT value, your platform must put in place a proxy in your legal documentation, and you must obtain the User’s consent. For more information, see the proxy management guide.
The introduction of Mangopay’s proxy management system makes it possible to apply SCA correctly in all cases. If the proxy action is activated for your platform and you send USER_NOT_PRESENT, but the user hasn’t given consent via the hosted SCA experience, then the request will fail.
In this case, your platform has two options:
- Obtain consent from the user by calling POST Manage proxy consent for a User, and then retry the transfer with
USER_NOT_PRESENT - Retry the action with the user on session to authenticate, by setting
ScaContexttoUSER_PRESENTand redirecting the user on thePendingUserAction.RedirectUrlreturned
USER_PRESENT case.
Example API request
On the GET endpoints for wallet access, theScaContext is a query parameter.
So, for example, a request to the GET List Wallets for a User would be made on the following URL (in Sandbox):
https://api.sandbox.mangopay.com/v2.01/ClientId/users/UserId/wallets?ScaContext=USER_PRESENT |
2. Redirect the user for SCA if required
For requests made withScaContext set to USER_PRESENT, the user is on session and can perform SCA. SCA for wallet access is only required once every 180 days. This means that if SCA was successfully performed by the user within the last 180 on any of the 4 endpoints above (and for any of their wallets), then SCA is not required.
If the 180-day exemption was applied (for USER_PRESENT), then the RedirectUrl is not returned because no redirection is necessary.
If SCA is required for the wallet access request, then a call to any of the 4 endpoints above will return a 401 - Unauthorized.
The RedirectUrl value needed for the user to be able authenticate is returned in the WWW-Authenticate response header, in the following format:
Example API response
401 response header
- The 4 endpoints impacted by SCA do not all return the same data type: the GET View a Wallet endpoint returns a JSON object while the others return an array. The 401 response allows them all to return the
RedirectUrlin the same way. - A 401 response is suitable thanks to its dedicated
WWW-Authenticateresponse header. - In a wallet access scenario, the data response is itself the fulfillment of the request. By contrast, in a transaction scenario, Mangopay has a precedent of accepting the request and then asynchronously returning a success or failure outcome.
RedirectUrl value to redirect the user.
Note – Encode and add your returnUrl before redirectionYou must add your
returnUrl before you redirect the user on the RedirectUrl value, otherwise the hosted web page cannot return them upon completion.For more details, see How to redirect a user for SCA.returnUrl, regardless of the outcome.
Once SCA is successful, subsequent calls to any of the above endpoints return the wallet or transaction data for the next 180 days, because SCA can be exempted, and then SCA redirection will be required again.
Handling wallet access outcome
There is no webhook notification for the SCA session itself, so in the case of wallet access you should retrieve thecontrolStatus query parameter appended to your returnUrl by Mangopay after the SCA session.
You can retry the wallet access by calling the relevant GET endpoint again.
Testing
SCA triggers in Sandbox
In Sandbox, SCA is triggered on the 4 endpoints listed above if all of the following are true:- The user has the
UserCategoryvalueOWNER - The user’s type is Natural or Soletrader
ScaContextisUSER_PRESENT- The last successful SCA session on any one of the 4 endpoints was more than 180 days ago (or has never happened)
- User has the
UserCategoryvaluePAYER - The legal user’s
LegalPersonTypeisBUSINESS,PARTNERSHIP, orORGANIZATION ScaContextisUSER_NOT_PRESENTor not sent (in which case it isnull)- The last successful SCA session on any one of the 4 endpoints occurred within the last 180 days
Postman
The Mangopay API Postman collection contains a dedicated folder for SCA on transfers and wallet access. The collection contains examples of using theScaContext query parameter with the value USER_PRESENT on wallet access endpoints, and a script for extracting the RedirectUrl from the 401 response.
See the Postman guide for details on how to fork the collection and set up your environment with your ClientId and API key.