Skip to navigation

Recurring card payments

Recurring payments occur 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 Mangopay provides a specific set of mocks to simulate the errors that occur when working with recurring objects.

1. Select the pay-in to which the mock applies

You can use the mock for a customer-initiated transaction (CIT) or a merchant-initiated transaction (MIT).

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

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

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 (CIT or MIT) using the POST Create a Recurring Card PayIn (CIT or MIT) endpoint, with the amount of 33501 for the DebitedFunds.

Example

This example simulates 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 fails and returns 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.

{
"AuthorId": "{{USER_NATURAL_PAYER}}",
"CardId": "{{CARD_CHALLENGE_FLOW_ID}}",
"CreditedWalletId": "{{USER_LEGAL_OWNER_WALLET_ID}}",
"FirstTransactionDebitedFunds": {
"Currency": "EUR",
"Amount": 10000
},
"FirstTransactionFees": {
"Currency": "EUR",
"Amount": 1000
},
"Billing": {
"FirstName": "{{$randomFirstName}}",
"LastName": "{{$randomLastName}}",
"Address": {
"AddressLine1": "{{$randomStreetAddress}}",
"AddressLine2": "01116",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
}
},
"Frequency": "Monthly",
"FixedNextAmount": true,
"FractionedPayment": false,
"Migration": false,
"NextTransactionDebitedFunds": {
"Currency": "EUR",
"Amount": 33501
},
"NextTransactionFees": {
"Currency": "EUR",
"Amount": 1000
},
}
{
"RecurringPayinRegistrationId": "{{RECURRING_PAYIN_REGISTRATION_ID}}",
"IpAddress": "{{$randomIPV6}}",
"BrowserInfo": {
"AcceptHeader": "text/html, application/xhtml+xml, application/xml;q=0.9, /;q=0.8",
"JavaEnabled": true,
"Language": "FR-FR",
"ColorDepth": 4,
"ScreenHeight": 1800,
"ScreenWidth": 400,
"TimeZoneOffset": 60,
"UserAgent": "Mozilla/5.0 (iPhone; CPU iPhone OS 13_6_1 like Mac OS X) AppleWebKit/605.1.15 (KHTML, like Gecko) Mobile/15E148",
"JavascriptEnabled": true
},
"SecureModeReturnURL": "http://example.com",
"StatementDescriptor": "Example123",
"Tag": "Created using Mangopay API Postman Collection",
"DebitedFunds": {
"Currency": "{{CURRENCY}}",
"Amount": 5000
},
"Fees": {
"Currency": "{{CURRENCY}}",
"Amount": 100
}
}
{
"RecurringPayinRegistrationId": "{{RECURRING_PAYIN_REGISTRATION_ID}}",
"StatementDescriptor": "Example123",
"Tag": "Created using Mangopay API Postman Collection",
"DebitedFunds": {
"Currency": "{{CURRENCY}}",
"Amount": 33501
},
"Fees": {
"Currency": "{{CURRENCY}}",
"Amount": 100
}
}
Recurring pay-in response
{
"Id": "195780716",
"Tag": "Created using Mangopay API Postman Collection",
"CreationDate": 1688721801,
"AuthorId": "195777863",
"CreditedUserId": "195777905",
"DebitedFunds": {
"Currency": "EUR",
"Amount": 33501
},
"CreditedFunds": {
"Currency": "EUR",
"Amount": 33401
},
"Fees": {
"Currency": "EUR",
"Amount": 100
},
"Status": "FAILED",
"ResultCode": "101102",
"ResultMessage": "Transaction refused by the bank (Amount limit)",
"ExecutionDate": null,
"Type": "PAYIN",
"Nature": "REGULAR",
"CreditedWalletId": "195777929",
"DebitedWalletId": null,
"PaymentType": "CARD",
"ExecutionType": "DIRECT",
"SecureMode": null,
"CardId": "195778022",
"SecureModeReturnURL": null,
"SecureModeRedirectURL": null,
"SecureModeNeeded": false,
"Culture": "EN",
"SecurityInfo": {
"AVSResult": "NO_CHECK"
},
"StatementDescriptor": "Example123",
"BrowserInfo": null,
"IpAddress": null,
"Billing": {
"FirstName": "Vernice",
"LastName": "Prohaska",
"Address": {
"AddressLine1": "5819 Heidenreich Mount",
"AddressLine2": "01116",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
}
},
"Shipping": {
"FirstName": "Vernice",
"LastName": "Prohaska",
"Address": {
"AddressLine1": "5819 Heidenreich Mount",
"AddressLine2": "01116",
"City": "Paris",
"Region": "Île-de-France",
"PostalCode": "75001",
"Country": "FR"
}
},
"Requested3DSVersion": null,
"Applied3DSVersion": null,
"RecurringPayinRegistrationId": "195780242"
}