> For clean Markdown of any page, append .md to the page URL. > For a complete documentation index, see https://docs.mangopay.com/api-reference/direct-debit-payins/create-direct-debit-payin/llms.txt. > For AI client integration (Claude Code, Cursor, etc.), connect to the MCP server at https://docs.mangopay.com/_mcp/server. # Create a Direct Debit PayIn POST https://api.sandbox.mangopay.com/v2.01/{ClientId}/payins/directdebit/direct Content-Type: application/json Create a Direct Debit PayIn Reference: https://docs.mangopay.com/api-reference/direct-debit-payins/create-direct-debit-payin ## Authentication - `Authorization` header (bearer token, required) — Bearer authentication of the form `Bearer `, where token is your auth token. If your platform is using a [proxy](/guides/sca/proxy-management) to take SCA-triggering action on behalf of users, you also need to integrate [mTLS authentication](/guides/sca/platform) and use the `api-mtls` base URL. ## Servers - `https://api.sandbox.mangopay.com` (Sandbox, default) - `https://api.mangopay.com` (Production) - `https://api-mtls.sandbox.mangopay.com` (mTLS Sandbox) - `https://api-mtls.mangopay.com` (mTLS Production) ## Request ### Path parameters - `ClientId` (string, required) — Platform's API account identifier, associated with the API key. ### Body (application/json) This endpoint expects a CreateADirectDebitPayInRequest. - `AuthorId` (string, required) — The unique identifier of the user at the source of the transaction. - `CreditedWalletId` (string, required) — The unique identifier of the credited wallet. - `DebitedFunds` (CreateADirectDebitPayInRequestDebitedFunds, required) — Information about the debited funds. - `Fees` (CreateADirectDebitPayInRequestFees, required) — Information about the fees. - `MandateId` (string, required) — The unique identifier of the mandate. - `CreditedUserId` (string, optional) — **Default value:** The unique identifier of the owner of the credited wallet. The unique identifier of the user whose wallet is credited. - `FlowDescriptor` (FlowDescriptorRequest, optional) — Information about the Owner beneficiaries targeted by the pay-in and its subsequent transfers, who must all be KYC/KYB verified when the pay-in request is made ([read more](/guides/payin-beneficiaries)). If the `FlowDescriptor.Beneficiaries` is sent in the API request, then: - The transaction's `CreditedWalletId` holder is disregarded in KYC/KYB checks. - **ALL** `UserId` values in the array must be one of: - `OWNER` whose `KYCLevel` is `REGULAR` - `PLATFORM` The pay-in `Status` becomes `FAILED` with `ResultCode` [002951](/errors/codes/002951) if at least one `FlowDescriptor.Beneficiaries.UserId` is: - `PAYER` - `OWNER` whose `KYCLevel` is `LIGHT` If the `FlowDescriptor.Beneficiaries` is not sent in the API request, then the `CreditedWalletId` holder is subject to KYC/KYB checks. This property is optional for backwards compatibility but is recommended for all pay-in flows, even when the `CreditedWalletId` holder is a `PAYER` or the same value as one of the `FlowDescriptor.Beneficiaries`. - `Tag` (string, optional) — Max. length: 255 characters Custom data that you can add to this object, such as unique identifiers in your system. To store multiple values, you can serialize them into a single string, for example a JSON object: `"{\"id_1\":AB123,\"id_2\":DE456}"`. - `StatementDescriptor` (string, optional) — Max. length: SEPA: 100 characters, BACS: truncated after 10 characters; only alphanumeric and spaces Custom description to appear on the user's bank statement along with the platform name. Different banks may show more or less information. See the Customizing bank statement references article for details. **Note:** On BACS Direct Debit pay-ins, the length is truncated at 10 alphanumeric characters or spaces, but the technical limit is 100. - `ProfilingAttemptReference` (string, optional) — The unique reference generated for the profiling session, used by the fraud prevention solution to produce recommendations for the transaction using the profiling data. **Note:** Parameter not returned by the API. Profiling feature available on request – contact Mangopay via the Dashboard for more information. ## Response ### 200 Success - `Id` (string, optional) — Max length: 128 characters (see [data formats](/api-reference/overview/data-formats) for details) The unique identifier of the object. - `CreationDate` (integer, optional) — Unix timestamp (UTC) of the date and time the object was created. - `AuthorId` (string, optional) — The unique identifier of the user at the source of the transaction. - `CreditedUserId` (string, optional) — **Default value:** The unique identifier of the owner of the credited wallet. The unique identifier of the user whose wallet is credited. - `FlowDescriptor` (FlowDescriptorResponse, optional) — Information about the Owner beneficiaries targeted by the pay-in and its subsequent transfers, who must all be KYC/KYB verified when the pay-in request is made ([read more](/guides/payin-beneficiaries)). If the `FlowDescriptor.Beneficiaries` is sent in the API request, then: - The transaction's `CreditedWalletId` holder is disregarded in KYC/KYB checks. - **ALL** `UserId` values in the array must be one of: - `OWNER` whose `KYCLevel` is `REGULAR` - `PLATFORM` The pay-in `Status` becomes `FAILED` with `ResultCode` [002951](/errors/codes/002951) if at least one `FlowDescriptor.Beneficiaries.UserId` is: - `PAYER` - `OWNER` whose `KYCLevel` is `LIGHT` If the `FlowDescriptor.Beneficiaries` is not sent in the API request, then the `CreditedWalletId` holder is subject to KYC/KYB checks. This property is optional for backwards compatibility but is recommended for all pay-in flows, even when the `CreditedWalletId` holder is a `PAYER` or the same value as one of the `FlowDescriptor.Beneficiaries`. - `Status` (string, optional) — **Returned values:** `CREATED`, `SUCCEEDED`, `FAILED` The status of the transaction. - `ExecutionDate` (integer, optional) — Unix timestamp (UTC) of the date and time the status changed to `SUCCEEDED`, indicating that the transaction occurred. The statuses `CREATED` and `FAILED` return an `ExecutionDate` of `null`. - `ChargeDate` (integer, optional) — The date used to notify the user of the future charge, set at midnight (00:00) on the given day. The user's account is usually debited the following day, but it depends on their bank. For more information on direct debit processing times, see the direct debit guide. - `Type` (string, optional) — **Returned values:** `PAYIN`, `TRANSFER`, `CONVERSION`, `PAYOUT` The type of the transaction. - `Nature` (string, optional) — **Returned values:** `REGULAR`, `REPUDIATION`, `REFUND`, `SETTLEMENT` The nature of the transaction, providing more information about the context in which the transaction occurred: - `REGULAR` – Relative to most of the transactions (pay-ins, payouts, and transfers) in a usual workflow. - `REPUDIATION` – Automatic withdrawal of funds from the platform's repudiation wallet as part of the dispute process (when the user has requested a chargeback). - `REFUND` – Reimbursement of a transaction to the user (pay-in refund), to a wallet (transfer refund), or of a payout (payout refund, only initiated by Mangopay). - `SETTLEMENT` – Transfer made to the repudiation wallet by the platform to settle a lost dispute. - `CreditedWalletId` (string, optional) — The unique identifier of the credited wallet. - `DebitedWalletId` (string, optional) — The unique identifier of the debited wallet. In the case of a pay-in, this value is always `null` since there is no debited wallet. - `CreditedFunds` (DirectDebitPayInResponseCreditedFunds, optional) — Information about the credited funds (`CreditedFunds` = `DebitedFunds` - `Fees`). - `DebitedFunds` (DirectDebitPayInResponseDebitedFunds, optional) — Information about the debited funds. - `Fees` (DirectDebitPayInResponseFees, optional) — Information about the fees. - `ResultCode` (string, optional) — The code indicating the result of the operation. This information is mostly used to handle errors or for filtering purposes. - `ResultMessage` (string, optional) — The explanation of the result code. - `PaymentType` (string, optional) — **Returned values:** `DIRECT_DEBIT` The payment type of the pay-in. - `ExecutionType` (string, optional) — **Returned values:** `DIRECT` The execution type of the pay-in. - `Tag` (string, optional) — Max. length: 255 characters Custom data that you can add to this object, such as unique identifiers in your system. To store multiple values, you can serialize them into a single string, for example a JSON object: `"{\"id_1\":AB123,\"id_2\":DE456}"`. - `MandateId` (string, optional) — The unique identifier of the mandate. - `StatementDescriptor` (string, optional) — Max. length: SEPA: 100 characters, BACS: truncated after 10 characters; only alphanumeric and spaces Custom description to appear on the user's bank statement along with the platform name. Different banks may show more or less information. See the Customizing bank statement references article for details. **Note:** On BACS Direct Debit pay-ins, the length is truncated at 10 alphanumeric characters or spaces, but the technical limit is 100. ## Errors ### 400 Bad Request Error Bad Request - `Message` (string, optional) — Description of the error. - `Type` (string, optional) — The category of the error. - `Id` (string, optional) — Unique identifier of the error instance, useful when contacting Mangopay for support. - `Date` (double, optional) — Unix timestamp (UTC) of the date and time the error was triggered. - `errors` (map from string to string, optional, nullable) — Object containing one or more field-level errors. ## Types ### CreateADirectDebitPayInRequestDebitedFunds Information about the debited funds. - `Currency` (string, required) — **Allowed values:** The three-letter ISO 4217 code (EUR, GBP, etc.) of a supported currency (depends on feature, contract, and activation settings). The currency of the amount. - `Amount` (integer, required) — The amount of the currency in its minor unit. For example, EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`. ### CreateADirectDebitPayInRequestFees Information about the fees. - `Currency` (string, required) — **Allowed values:** The three-letter ISO 4217 code (EUR, GBP, etc.) of a supported currency (depends on feature, contract, and activation settings). The currency of the amount. - `Amount` (integer, required) — The amount of the currency in its minor unit. For example, EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`. ### FlowDescriptorRequest Information about the Owner beneficiaries targeted by the pay-in and its subsequent transfers, who must all be KYC/KYB verified when the pay-in request is made ([read more](/guides/payin-beneficiaries)). If the `FlowDescriptor.Beneficiaries` is sent in the API request, then: - The transaction's `CreditedWalletId` holder is disregarded in KYC/KYB checks. - **ALL** `UserId` values in the array must be one of: - `OWNER` whose `KYCLevel` is `REGULAR` - `PLATFORM` The pay-in `Status` becomes `FAILED` with `ResultCode` [002951](/errors/codes/002951) if at least one `FlowDescriptor.Beneficiaries.UserId` is: - `PAYER` - `OWNER` whose `KYCLevel` is `LIGHT` If the `FlowDescriptor.Beneficiaries` is not sent in the API request, then the `CreditedWalletId` holder is subject to KYC/KYB checks. This property is optional for backwards compatibility but is recommended for all pay-in flows, even when the `CreditedWalletId` holder is a `PAYER` or the same value as one of the `FlowDescriptor.Beneficiaries`. - `Beneficiaries` (list of FlowDescriptorRequestBeneficiariesItems, optional, nullable) — Max. length: 5 items The list of up to 5 Natural or Legal Users declared as beneficiaries of the pay-in and its subsequent transfers, who must all be KYC/KYB verified when the pay-in request is made. The pay-in also fails if the `Beneficiaries` array contains nulled objects or invalid `UserId` values. ### FlowDescriptorResponse Information about the Owner beneficiaries targeted by the pay-in and its subsequent transfers, who must all be KYC/KYB verified when the pay-in request is made ([read more](/guides/payin-beneficiaries)). If the `FlowDescriptor.Beneficiaries` is sent in the API request, then: - The transaction's `CreditedWalletId` holder is disregarded in KYC/KYB checks. - **ALL** `UserId` values in the array must be one of: - `OWNER` whose `KYCLevel` is `REGULAR` - `PLATFORM` The pay-in `Status` becomes `FAILED` with `ResultCode` [002951](/errors/codes/002951) if at least one `FlowDescriptor.Beneficiaries.UserId` is: - `PAYER` - `OWNER` whose `KYCLevel` is `LIGHT` If the `FlowDescriptor.Beneficiaries` is not sent in the API request, then the `CreditedWalletId` holder is subject to KYC/KYB checks. This property is optional for backwards compatibility but is recommended for all pay-in flows, even when the `CreditedWalletId` holder is a `PAYER` or the same value as one of the `FlowDescriptor.Beneficiaries`. - `FlowId` (string, optional) — Unique identifier of the payment flow, used by Mangopay for internal purposes. - `Beneficiaries` (list of FlowDescriptorResponseBeneficiariesItems, optional, nullable) — Max. length: 5 items The list of up to 5 Natural or Legal Users declared as beneficiaries of the pay-in, who must all be KYC/KYB verified when the pay-in request is made. The pay-in also fails if the `Beneficiaries` array contains nulled objects or invalid `UserId` values. ### DirectDebitPayInResponseCreditedFunds Information about the credited funds (`CreditedFunds` = `DebitedFunds` - `Fees`). - `Currency` (string, optional) — **Allowed values:** The three-letter ISO 4217 code (EUR, GBP, etc.) of a supported currency (depends on feature, contract, and activation settings). The currency of the amount. - `Amount` (integer, optional) — The amount of the currency in its minor unit. For example, EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`. ### DirectDebitPayInResponseDebitedFunds Information about the debited funds. - `Currency` (string, optional) — **Allowed values:** The three-letter ISO 4217 code (EUR, GBP, etc.) of a supported currency (depends on feature, contract, and activation settings). The currency of the amount. - `Amount` (integer, optional) — The amount of the currency in its minor unit. For example, EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`. ### DirectDebitPayInResponseFees Information about the fees. - `Currency` (string, optional) — **Allowed values:** The three-letter ISO 4217 code (EUR, GBP, etc.) of a supported currency (depends on feature, contract, and activation settings). The currency of the amount. - `Amount` (integer, optional) — The amount of the currency in its minor unit. For example, EUR 12.60 would be represented as `1260` whereas JPY 12 would be represented as just `12`. ### FlowDescriptorRequestBeneficiariesItems - `UserId` (string, optional) — The unique identifier of the Natural User or Legal User declared as a beneficiary of the pay-in. ### FlowDescriptorResponseBeneficiariesItems - `UserId` (string, optional) — The unique identifier of the Natural User or Legal User declared as a beneficiary of the pay-in. ## Examples ### 200 **Request** ```json { "body": { "AuthorId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T", "CreditedWalletId": "wlt_m_01J6EN9X1Q0PGM0CJ9QD197CRG", "DebitedFunds": { "Amount": 1200, "Currency": "EUR" }, "Fees": { "Amount": 12, "Currency": "EUR" }, "FlowDescriptor": { "Beneficiaries": [ { "UserId": "user_m_02APAYTWSDYXHXN1FRTKX9WMA2" } ] }, "MandateId": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ", "StatementDescriptor": "Example123", "Tag": "Created using the Mangopay API Postman collection" } } ``` **Response** ```json { "Id": "payin_m_01J9C36G3DYBNZEHVZ5HC7WB5D", "CreationDate": 1728056606, "AuthorId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T", "CreditedUserId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T", "FlowDescriptor": { "FlowId": "flow_wt_97448e0a-5bc6-4b83-ac29-cdfcadf60a08", "Beneficiaries": [ { "UserId": "user_m_02APAYTWSDYXHXN1FRTKX9WMA2" } ] }, "Status": "CREATED", "ExecutionDate": null, "ChargeDate": null, "Type": "PAYIN", "Nature": "REGULAR", "CreditedWalletId": "wlt_m_01J6EN9X1Q0PGM0CJ9QD197CRG", "DebitedWalletId": null, "CreditedFunds": { "Currency": "EUR", "Amount": 1188 }, "DebitedFunds": { "Currency": "EUR", "Amount": 1200 }, "Fees": { "Currency": "EUR", "Amount": 12 }, "ResultCode": null, "ResultMessage": null, "PaymentType": "DIRECT_DEBIT", "ExecutionType": "DIRECT", "Tag": "Created using Mangopay API Postman Collection", "MandateId": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ", "StatementDescriptor": "Example123" } ``` **SDK Code** ```python 200 from pprint import pprint import mangopay mangopay.client_id='your-client-id' mangopay.apikey='your-api-key' from mangopay.api import APIRequest handler = APIRequest(sandbox=True) from mangopay.resources import NaturalUser, DirectDebitDirectPayIn, Money natural_user = NaturalUser.get('213753890') direct_debit_direct_payin = DirectDebitDirectPayIn( author_id = natural_user.id, credited_wallet_id = '213754077', debited_funds = Money(amount='1000', currency='EUR'), fees = Money(amount='100', currency='EUR'), tag = 'Created using the Mangopay Python SDK', mandate_id = '214224837', statement_descriptor = 'Jan2024' ) create_direct_debit_direct_payin = direct_debit_direct_payin.save() pprint(create_direct_debit_direct_payin) ``` ```javascript 200 const mangopayInstance = require('mangopay4-nodejs-sdk') const mangopay = new mangopayInstance({ clientId: 'your-client-id', clientApiKey: 'your-api-key', }) let myPayIn = { PaymentType: 'DIRECT_DEBIT', ExecutionType: 'DIRECT', AuthorId: '168935886', Tag: 'Created with Mangopay Node.js SDK', CreditedUserId: '168935886', DebitedFunds: { Currency: 'EUR', Amount: 1000, }, Fees: { Currency: 'EUR', Amount: 100, }, CreditedWalletId: '168935920', MandateId: '193168736', StatementDescriptor: 'Mangopay', } const createDirectDirectDebitPayIn = async (payin) => { return await mangopay.PayIns.create(payin) .then((response) => { console.info(response) return response }) .catch((err) => { console.log(err) return false }) } createDirectDirectDebitPayIn(myPayIn) ``` ```java 200 import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.mangopay.MangoPayApi; import com.mangopay.core.Money; import com.mangopay.core.enumerations.CurrencyIso; import com.mangopay.entities.PayIn; import com.mangopay.entities.subentities.PayInExecutionDetailsDirect; import com.mangopay.entities.subentities.PayInPaymentDetailsDirectDebit; public class CreateDirectDirectDebitPayIn { public static void main(String[] args) throws Exception { MangoPayApi mangopay = new MangoPayApi(); mangopay.getConfig().setClientId("your-client-id"); mangopay.getConfig().setClientPassword("your-api-key"); var userId = "user_m_01HT2NFK7Z2BRQNGNHMY30VVTT"; var walletId = "wlt_m_01HTF5S9MG0XXBZ8A0550MED3Z"; var mandateId = "mdt_m_01HW30HV697QX2SQN7E500FQBJ"; PayIn payIn = new PayIn(); Money debitedFunds = new Money(); debitedFunds.setAmount(1000); debitedFunds.setCurrency(CurrencyIso.EUR); Money fees = new Money(); fees.setAmount(0); fees.setCurrency(CurrencyIso.EUR); PayInPaymentDetailsDirectDebit paymentDetails = new PayInPaymentDetailsDirectDebit(); paymentDetails.setMandateId(mandateId); paymentDetails.setStatementDescriptor("Apr2024"); PayInExecutionDetailsDirect executionDetails = new PayInExecutionDetailsDirect(); payIn.setAuthorId(userId); payIn.setCreditedWalletId(walletId); payIn.setDebitedFunds(debitedFunds); payIn.setFees(fees); payIn.setPaymentDetails(paymentDetails); payIn.setExecutionDetails(executionDetails); PayIn createPayIn = mangopay.getPayInApi().create(payIn); Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create(); String prettyJson = prettyPrint.toJson(createPayIn); System.out.println(prettyJson); } } ``` ```csharp 200 using MangoPay.SDK; using MangoPay.SDK.Entities.PUT; using Newtonsoft.Json; class Program { static async Task Main(string[] args) { MangoPayApi api = new MangoPayApi(); api.Config.ClientId = "your-client-id"; api.Config.ClientPassword = "your-api-key"; var userId = "user_m_01J2TZ261WZNDM0ZDRWGDYA4GN"; var walletId = "wlt_m_01J30991BXBB7VF28PBS82EWD3"; var returnUrl = "https://www.mangopay.com/docs/please-ignore/"; var mandateId = "mdt_m_01J3D1C35QZHHAT7XJ4WXTHRTJ"; var payIn = new PayInMandateDirectPostDTO( userId, new Money { Amount = 100, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletId, returnUrl, mandateId); var createDirectDirectDebitPayIn = await api.PayIns.CreateMandateDirectDebitAsync(payIn); string prettyPrint = JsonConvert.SerializeObject(createDirectDirectDebitPayIn, Formatting.Indented); Console.WriteLine(prettyPrint); } } ``` ```php 200 Config->ClientId = 'your-client-id'; $api->Config->ClientPassword = 'your-api-key'; $api->Config->TemporaryFolder = 'tmp/'; try { $userId = 'user_m_01HYDWQNXC3M655SJXVGNDP91J'; $walletId = 'wlt_m_01HYDWR4NMAF0GRM2GZ25479EG'; $mandateId = 'mdt_m_01HYDWRQNDFC7R7P37DWH8C9SP'; $directDirectDebitPayIn = new \MangoPay\PayIn(); $directDirectDebitPayIn->AuthorId = $userId; $directDirectDebitPayIn->CreditedWalletId = $walletId; $directDirectDebitPayIn->DebitedFunds = new Money(); $directDirectDebitPayIn->DebitedFunds->Amount = 1000; $directDirectDebitPayIn->DebitedFunds->Currency = 'EUR'; $directDirectDebitPayIn->Fees = new Money(); $directDirectDebitPayIn->Fees->Amount = 0; $directDirectDebitPayIn->Fees->Currency = 'EUR'; $directDirectDebitPayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsDirectDebit(); $directDirectDebitPayIn->PaymentDetails->MandateId = $mandateId; $directDirectDebitPayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect(); $directDirectDebitPayIn->Tag = 'Created using the Mangopay PHP SDK'; $createPayIn = $api->PayIns->Create($directDirectDebitPayIn); print_r($createPayIn); } catch(MGPResponseException $e) { print_r($e); } catch(MGPException $e) { print_r($e); } ``` ```ruby 200 require 'mangopay' MangoPay.configure do |client| client.preproduction = true client.client_id = 'your-client-id' client.client_apiKey = 'your-api-key' client.log_file = File.join(Dir.pwd, 'mangopay.log') end def createDirectDirectDebitPayIn(payInObject) begin response = MangoPay::PayIn::DirectDebit::Direct.create(payInObject) puts response return response rescue MangoPay::ResponseError => error puts "Failed to create pay-in: #{error.message}" puts "Error details: #{error.details}" return false end end myPayIn = { AuthorId:'195074410', Tag: 'Created with Mangopay Ruby SDK', CreditedUserId:'195074410', DebitedFunds: { Currency: 'EUR', Amount: 1000, }, Fees: { Currency: 'EUR', Amount: 100, }, CreditedWalletId: '195074411', MandateId: '195074413', StatementDescriptor: 'Mangopay', } createDirectDirectDebitPayIn(myPayIn) ``` ### Failed due to invalid mandate status **Request** ```json { "body": { "AuthorId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T", "CreditedWalletId": "wlt_m_01J6EN9X1Q0PGM0CJ9QD197CRG", "DebitedFunds": { "Amount": 1200, "Currency": "EUR" }, "Fees": { "Amount": 12, "Currency": "EUR" }, "FlowDescriptor": { "Beneficiaries": [ { "UserId": "user_m_02APAYTWSDYXHXN1FRTKX9WMA2" } ] }, "MandateId": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ", "StatementDescriptor": "Example123", "Tag": "Created using the Mangopay API Postman collection" } } ``` **Response** ```json { "Id": "payin_m_01J9C36G3DYBNZEHVZ5HC7WB5D", "CreationDate": 1728056606, "AuthorId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T", "CreditedUserId": "user_m_01J8SY95DQ5CM7DH43NQCAS65T", "FlowDescriptor": { "FlowId": "flow_wt_97448e0a-5bc6-4b83-ac29-cdfcadf60a08", "Beneficiaries": [ { "UserId": "user_m_02APAYTWSDYXHXN1FRTKX9WMA2" } ] }, "Status": "FAILED", "ExecutionDate": null, "ChargeDate": null, "Type": "PAYIN", "Nature": "REGULAR", "CreditedWalletId": "wlt_m_01J6EN9X1Q0PGM0CJ9QD197CRG", "DebitedWalletId": null, "CreditedFunds": { "Currency": "EUR", "Amount": 1188 }, "DebitedFunds": { "Currency": "EUR", "Amount": 1200 }, "Fees": { "Currency": "EUR", "Amount": 12 }, "ResultCode": 1833, "ResultMessage": "The Status of this Mandate does not allow for payments", "PaymentType": "DIRECT_DEBIT", "ExecutionType": "DIRECT", "Tag": "Created using Mangopay API Postman Collection", "MandateId": "mdt_m_01J999B9HSEDH9CZDEXXYZGHEZ", "StatementDescriptor": "Example123" } ``` **SDK Code** ```python Failed due to invalid mandate status from pprint import pprint import mangopay mangopay.client_id='your-client-id' mangopay.apikey='your-api-key' from mangopay.api import APIRequest handler = APIRequest(sandbox=True) from mangopay.resources import NaturalUser, DirectDebitDirectPayIn, Money natural_user = NaturalUser.get('213753890') direct_debit_direct_payin = DirectDebitDirectPayIn( author_id = natural_user.id, credited_wallet_id = '213754077', debited_funds = Money(amount='1000', currency='EUR'), fees = Money(amount='100', currency='EUR'), tag = 'Created using the Mangopay Python SDK', mandate_id = '214224837', statement_descriptor = 'Jan2024' ) create_direct_debit_direct_payin = direct_debit_direct_payin.save() pprint(create_direct_debit_direct_payin) ``` ```javascript Failed due to invalid mandate status const mangopayInstance = require('mangopay4-nodejs-sdk') const mangopay = new mangopayInstance({ clientId: 'your-client-id', clientApiKey: 'your-api-key', }) let myPayIn = { PaymentType: 'DIRECT_DEBIT', ExecutionType: 'DIRECT', AuthorId: '168935886', Tag: 'Created with Mangopay Node.js SDK', CreditedUserId: '168935886', DebitedFunds: { Currency: 'EUR', Amount: 1000, }, Fees: { Currency: 'EUR', Amount: 100, }, CreditedWalletId: '168935920', MandateId: '193168736', StatementDescriptor: 'Mangopay', } const createDirectDirectDebitPayIn = async (payin) => { return await mangopay.PayIns.create(payin) .then((response) => { console.info(response) return response }) .catch((err) => { console.log(err) return false }) } createDirectDirectDebitPayIn(myPayIn) ``` ```java Failed due to invalid mandate status import com.google.gson.Gson; import com.google.gson.GsonBuilder; import com.mangopay.MangoPayApi; import com.mangopay.core.Money; import com.mangopay.core.enumerations.CurrencyIso; import com.mangopay.entities.PayIn; import com.mangopay.entities.subentities.PayInExecutionDetailsDirect; import com.mangopay.entities.subentities.PayInPaymentDetailsDirectDebit; public class CreateDirectDirectDebitPayIn { public static void main(String[] args) throws Exception { MangoPayApi mangopay = new MangoPayApi(); mangopay.getConfig().setClientId("your-client-id"); mangopay.getConfig().setClientPassword("your-api-key"); var userId = "user_m_01HT2NFK7Z2BRQNGNHMY30VVTT"; var walletId = "wlt_m_01HTF5S9MG0XXBZ8A0550MED3Z"; var mandateId = "mdt_m_01HW30HV697QX2SQN7E500FQBJ"; PayIn payIn = new PayIn(); Money debitedFunds = new Money(); debitedFunds.setAmount(1000); debitedFunds.setCurrency(CurrencyIso.EUR); Money fees = new Money(); fees.setAmount(0); fees.setCurrency(CurrencyIso.EUR); PayInPaymentDetailsDirectDebit paymentDetails = new PayInPaymentDetailsDirectDebit(); paymentDetails.setMandateId(mandateId); paymentDetails.setStatementDescriptor("Apr2024"); PayInExecutionDetailsDirect executionDetails = new PayInExecutionDetailsDirect(); payIn.setAuthorId(userId); payIn.setCreditedWalletId(walletId); payIn.setDebitedFunds(debitedFunds); payIn.setFees(fees); payIn.setPaymentDetails(paymentDetails); payIn.setExecutionDetails(executionDetails); PayIn createPayIn = mangopay.getPayInApi().create(payIn); Gson prettyPrint = new GsonBuilder().setPrettyPrinting().create(); String prettyJson = prettyPrint.toJson(createPayIn); System.out.println(prettyJson); } } ``` ```csharp Failed due to invalid mandate status using MangoPay.SDK; using MangoPay.SDK.Entities.PUT; using Newtonsoft.Json; class Program { static async Task Main(string[] args) { MangoPayApi api = new MangoPayApi(); api.Config.ClientId = "your-client-id"; api.Config.ClientPassword = "your-api-key"; var userId = "user_m_01J2TZ261WZNDM0ZDRWGDYA4GN"; var walletId = "wlt_m_01J30991BXBB7VF28PBS82EWD3"; var returnUrl = "https://www.mangopay.com/docs/please-ignore/"; var mandateId = "mdt_m_01J3D1C35QZHHAT7XJ4WXTHRTJ"; var payIn = new PayInMandateDirectPostDTO( userId, new Money { Amount = 100, Currency = CurrencyIso.EUR }, new Money { Amount = 0, Currency = CurrencyIso.EUR }, walletId, returnUrl, mandateId); var createDirectDirectDebitPayIn = await api.PayIns.CreateMandateDirectDebitAsync(payIn); string prettyPrint = JsonConvert.SerializeObject(createDirectDirectDebitPayIn, Formatting.Indented); Console.WriteLine(prettyPrint); } } ``` ```php Failed due to invalid mandate status Config->ClientId = 'your-client-id'; $api->Config->ClientPassword = 'your-api-key'; $api->Config->TemporaryFolder = 'tmp/'; try { $userId = 'user_m_01HYDWQNXC3M655SJXVGNDP91J'; $walletId = 'wlt_m_01HYDWR4NMAF0GRM2GZ25479EG'; $mandateId = 'mdt_m_01HYDWRQNDFC7R7P37DWH8C9SP'; $directDirectDebitPayIn = new \MangoPay\PayIn(); $directDirectDebitPayIn->AuthorId = $userId; $directDirectDebitPayIn->CreditedWalletId = $walletId; $directDirectDebitPayIn->DebitedFunds = new Money(); $directDirectDebitPayIn->DebitedFunds->Amount = 1000; $directDirectDebitPayIn->DebitedFunds->Currency = 'EUR'; $directDirectDebitPayIn->Fees = new Money(); $directDirectDebitPayIn->Fees->Amount = 0; $directDirectDebitPayIn->Fees->Currency = 'EUR'; $directDirectDebitPayIn->PaymentDetails = new \MangoPay\PayInPaymentDetailsDirectDebit(); $directDirectDebitPayIn->PaymentDetails->MandateId = $mandateId; $directDirectDebitPayIn->ExecutionDetails = new \MangoPay\PayInExecutionDetailsDirect(); $directDirectDebitPayIn->Tag = 'Created using the Mangopay PHP SDK'; $createPayIn = $api->PayIns->Create($directDirectDebitPayIn); print_r($createPayIn); } catch(MGPResponseException $e) { print_r($e); } catch(MGPException $e) { print_r($e); } ``` ```ruby Failed due to invalid mandate status require 'mangopay' MangoPay.configure do |client| client.preproduction = true client.client_id = 'your-client-id' client.client_apiKey = 'your-api-key' client.log_file = File.join(Dir.pwd, 'mangopay.log') end def createDirectDirectDebitPayIn(payInObject) begin response = MangoPay::PayIn::DirectDebit::Direct.create(payInObject) puts response return response rescue MangoPay::ResponseError => error puts "Failed to create pay-in: #{error.message}" puts "Error details: #{error.details}" return false end end myPayIn = { AuthorId:'195074410', Tag: 'Created with Mangopay Ruby SDK', CreditedUserId:'195074410', DebitedFunds: { Currency: 'EUR', Amount: 1000, }, Fees: { Currency: 'EUR', Amount: 100, }, CreditedWalletId: '195074411', MandateId: '195074413', StatementDescriptor: 'Mangopay', } createDirectDirectDebitPayIn(myPayIn) ```