Recurring card payments

We refer to recurring payments when the platform repeatedly charges the end user’s card at regular intervals for the goods and/or services provided.

Learn more about recurring payments →

The recurring card payments feature is testable in Sandbox and a specific set of mocks has been developed to simulate the errors that occur when working with recurring objects.

1. Select the pay-in to which the mock is going to apply

You can use the mock for a customer-initiated or a merchant-initiated transaction.

To do so, you may use the Create a Recurring PayIn Registration endpoint, and use the 33501 value in one of the following Amount parameters in the body of the request:

  • FirstTransactionDebitedFunds to test an MIT
  • NextTransactionDebitedFunds to test a CIT

2. Choose the error to simulate in the recurring registration

You can use the value below in the AddressLine2 parameter of the Billing object in your recurring pay-in registration body.

AddressLine2 valueSimulated caseReturned error code
01100Failed pay-in101101
01116Failed due to card limit reached101199
01125Failed due to inactive card101106
01131Reauthentication request from the bank (MIT only)101305
03022Failed SCA (CIT only)101301

3. Make the recurring pay-in

Make the pay-in (MIT or CIT) with the Create a Recurring PayIn endpoint with the amount of 33501  for the DebitedFunds.

Example

In this example, we simulate a failed merchant-initiated transaction due to an inactive card by following these steps:

  • Create a Recurring PayIn Registration with the mock values
  • Create an initial CIT for the authentication
  • Create an MIT which will fail, returning the 101106 error.

Note - Mocks available in Postman Collection

The Mangopay API Postman Collection contains the full flow for the recurring mocks to help you test faster.

1{
2 "AuthorId": "{{USER_NATURAL_PAYER}}",
3 "CardId": "{{CARD_CHALLENGE_FLOW_ID}}",
4 "CreditedWalletId": "{{USER_LEGAL_OWNER_WALLET_ID}}",
5 "FirstTransactionDebitedFunds": {
6 "Currency": "EUR",
7 "Amount": 10000
8 },
9 "FirstTransactionFees": {
10 "Currency": "EUR",
11 "Amount": 1000
12 },
13 "Billing": {
14 "FirstName": "{{$randomFirstName}}",
15 "LastName": "{{$randomLastName}}",
16 "Address": {
17 "AddressLine1": "{{$randomStreetAddress}}",
18 "AddressLine2": "01116",
19 "City": "Paris",
20 "Region": "Île-de-France",
21 "PostalCode": "75001",
22 "Country": "FR"
23 }
24 },
25 "Frequency": "Monthly",
26 "FixedNextAmount": true,
27 "FractionedPayment": false,
28 "Migration": false,
29 "NextTransactionDebitedFunds": {
30 "Currency": "EUR",
31 "Amount": 33501
32 },
33 "NextTransactionFees": {
34 "Currency": "EUR",
35 "Amount": 1000
36 },
37}
1{
2 "RecurringPayinRegistrationId": "{{RECURRING_PAYIN_REGISTRATION_ID}}",
3 "IpAddress": "{{$randomIPV6}}",
4 "BrowserInfo": {
5 "AcceptHeader": "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
6 "JavaEnabled": true,
7 "Language": "FR-FR",
8 "ColorDepth": 4,
9 "ScreenHeight": 1800,
10 "ScreenWidth": 400,
11 "TimeZoneOffset": 60,
12 "UserAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",
13 "JavascriptEnabled": true
14 },
15 "SecureModeReturnURL": "http://example.com",
16 "StatementDescriptor": "Example123",
17 "Tag": "Created using Mangopay API Postman Collection",
18 "DebitedFunds": {
19 "Currency": "{{CURRENCY}}",
20 "Amount": 5000
21 },
22 "Fees": {
23 "Currency": "{{CURRENCY}}",
24 "Amount": 100
25 }
26}
1{
2 "RecurringPayinRegistrationId": "{{RECURRING_PAYIN_REGISTRATION_ID}}",
3 "StatementDescriptor": "Example123",
4 "Tag": "Created using Mangopay API Postman Collection",
5 "DebitedFunds": {
6 "Currency": "{{CURRENCY}}",
7 "Amount": 33501
8 },
9 "Fees": {
10 "Currency": "{{CURRENCY}}",
11 "Amount": 100
12 }
13}
Recurring pay-in response
1{
2 "Id": "195780716",
3 "Tag": "Created using Mangopay API Postman Collection",
4 "CreationDate": 1688721801,
5 "AuthorId": "195777863",
6 "CreditedUserId": "195777905",
7 "DebitedFunds": {
8 "Currency": "EUR",
9 "Amount": 33501
10 },
11 "CreditedFunds": {
12 "Currency": "EUR",
13 "Amount": 33401
14 },
15 "Fees": {
16 "Currency": "EUR",
17 "Amount": 100
18 },
19 "Status": "FAILED",
20 "ResultCode": "101102",
21 "ResultMessage": "Transaction refused by the bank (Amount limit)",
22 "ExecutionDate": null,
23 "Type": "PAYIN",
24 "Nature": "REGULAR",
25 "CreditedWalletId": "195777929",
26 "DebitedWalletId": null,
27 "PaymentType": "CARD",
28 "ExecutionType": "DIRECT",
29 "SecureMode": null,
30 "CardId": "195778022",
31 "SecureModeReturnURL": null,
32 "SecureModeRedirectURL": null,
33 "SecureModeNeeded": false,
34 "Culture": "EN",
35 "SecurityInfo": {
36 "AVSResult": "NO_CHECK"
37 },
38 "StatementDescriptor": "Example123",
39 "BrowserInfo": null,
40 "IpAddress": null,
41 "Billing": {
42 "FirstName": "Vernice",
43 "LastName": "Prohaska",
44 "Address": {
45 "AddressLine1": "5819 Heidenreich Mount",
46 "AddressLine2": "01116",
47 "City": "Paris",
48 "Region": "Île-de-France",
49 "PostalCode": "75001",
50 "Country": "FR"
51 }
52 },
53 "Shipping": {
54 "FirstName": "Vernice",
55 "LastName": "Prohaska",
56 "Address": {
57 "AddressLine1": "5819 Heidenreich Mount",
58 "AddressLine2": "01116",
59 "City": "Paris",
60 "Region": "Île-de-France",
61 "PostalCode": "75001",
62 "Country": "FR"
63 }
64 },
65 "Requested3DSVersion": null,
66 "Applied3DSVersion": null,
67 "RecurringPayinRegistrationId": "195780242"
68}