Skip to main content

Create payment methods in batches with existing mandate IDs on GoCardless

Zuora

Create payment methods in batches with existing mandate IDs on GoCardless

If you have existing mandates for payment methods on GoCardless and want to create payment methods in Zuora with the existing mandate IDs, you can use the CRUD: Create a payment method API operation and specify your existing mandate IDs through one of the following fields according to the payment method type:

  • Use the TokenId field for the following Bank Transfer payment methods:
    • Direct Debit SE (Autogiro)
    • Direct Debit UK (BACS)
    • Direct Entry AU (BECS)
    • Direct Debit NZ (BECS NZ)
    • Direct Debit DK (Betalingsservice)
    • Pre-Authorized Debit (PAD)
    • SEPA
  • Use the MandateID field for ACH payment methods.

This article provides instructions on how to use the “CRUD: Create a payment method” operation with an API platform where requests can be run in batches. In this article, Postman is used as an example.

Before you begin

You have the basic knowledge of Postman and you have registered a Postman account. Postman is an API platform for developers to build and use APIs. For more information about Postman, see the Postman Learning Center.

Procedure

To create payment methods in batches with existing mandate IDs through the “CRUD: Create a payment method” API operation, perform the following steps. Detailed instructions for each step are provided in the later sections of this article.

  1. Prepare a CSV file containing the data of the payment methods to be created.
  2. In Postman, create a collection and an API request for Zuora’s “CRUD: Create a payment method” API operation. In the following sections, a “Test bulk create PM” collection and a “Create BankTransfer Payment Method” API request will be created, as an example.
  3. In Postman, edit the configuration of your collection and run the collection.
  4. In Postman, check the result in the response section.

Step 1 Prepare a CSV file

Prepare a CSV file containing the data of the payment methods to be created. Use the field names as the column headers. Ensure that all the following fields and data are included in the CSV file:

  • All the required fields for creating the payment methods. See the field description of the CRUD: Create a payment method API operation.
  • The TokenId (for Bank Transfer) or the MandateID (for ACH) field. Fill your existing GoCardless mandate IDs in the TokenId or the MandateID column of each payment method.
  • Other allowed fields that you want to save in Zuora for the payment methods.

The following image provides an example of the CSV file prepared for BECS payment methods.

csv sample.png

Step 2 Create a collection and an API request in Postman

  1. Log in to Postman and open your Workspace.
  2. Create a collection:
    1. Click New > Collection.
    2. Rename the new collection to “Test bulk create PM”.
  3. Create an API request in the collection:
    1. In the left navigation pane, click the “Test bulk create PM” collection you just created to expand it.
    2. In the expanded message, click Add a request.
    3. Rename the request to “Create BankTransfer Payment Method”.

      create-collection.png

  4. Construct your request with the following data:
    Request type POST
    Request URL

    https://rest.zuora.com/v1/object/payment-method

    Replace “rest.zuora.com” with the domain value according to the environment you are using.

    Headers
    1. Enter apiAccessKeyId as a key and use your Zuora user name as the value for it.
    2. Enter apiSecretAccessKey as a key and use your Zuora password as the value for it.
    3. Enter Content-Type as a key and application/json as the value.

    headers.png

    Body

    Click raw and enter the following request body. In addition to the fields in the following sample request, if you have more fields (columns) in your CSV file, add the corresponding fields to the request body. The columns in your CSV file must match the fields in the API request body.

    Specify the value of the BankTransferType field according to the type of the payment methods to be created.

    If SkipValidation is true, the authentication request will not be sent to the payment gateway to validate the payment method.

    {
    "AccountId": {{AccountId}},
    "BankTransferType": "DirectDebitNZ",
    "BankTransferAccountName": {{BankTransferAccountName}},
    "BankTransferAccountNumber": {{BankTransferAccountNumber}},
    "BankCode":{{BankCode}},
    "BranchCode":{{BranchCode}},
    "Type": "BankTransfer",
    "Country": "NZ",
    "TokenId": {{TokenId}},
    "SkipValidation": true
    }
    

    body.png

  5. Save your request.

Step 3 Run the collection

  1. In the left navigation pane, click the View more actions icon next to the “Test bulk create PM” collection, and then click Run collection.

    run-collection.png

  2. On the Runner tab, edit the settings:
    • In the Data section, click Select File and add the CSV file you prepared.
    • Click Advanced settings to expand the section if it is collapsed, and then select Save responses and Keep variable values.
  3. Click the Run Test Bulk Create PM button to run the collection.

    runner.png

Step 4 Check the result

All the requests executed are listed for the collection and you can check the response by clicking each of the requests.

result.png

Additional information

In addition to the approach described in the preceding sections, you can also use the following approaches to create payment methods in batches, which require either more knowledge of API or the purchase of additional applications.

  • Create action API operation
    For more information about how to use this operation and its limitations, see the API Reference for this operation. 
  • Zuora Developer Tools
    It is an add-on product that eases the effort to perform mass migration and updates. For more information, contact your Zuora CSM.
  • Zuora Workflow
    It is an add-on product that automates a set of business processes that otherwise need to be performed manually and repetitively. For more information, contact your Zuora CSM.