Skip to main content

Documentation

Get Payment Method Required Fields

Retrieve the required fields for a payment method.

The fields are returned as a list of objects. The name of each field appears in the name field of the response.

Note

  • Rapyd employs a unique variant of regex. Note the following differences:

    • A single backslash matches a backslash as an ordinary character.

    • A backslash followed by an alphabetic character matches a string of two characters.

    • A special character such as \n is indicated as \\n.

  • Some payment methods require a predefined customer with required fields. See also the example on this page.

  • Some payment methods require fields when certain conditions are met.

  • This endpoint replaces the deprecated endpoint - GET /v1/payment_methods/required_fields/:type

    Rapyd will continue to support the deprecated endpoint until December 31, 2024.

    • type

    • The type of the payment method.

Code Samples
    • .NET

      • using System;
        namespace RapydApiRequestSample {
            class Program {
                static void Main(string[]args) {
                    try {
                        string type = "us_visa_card";
                        string result = RapydApiRequestSample.Utilities.MakeRequest("GET", $ "/v1/payment_methods/{type}/required_fields");
                        Console.WriteLine(result);
                    } catch (Exception e) {
                        Console.WriteLine("Error completing request: " + e.Message);
                    }
                }
            }
        }
        
    • JavaScript

      • const makeRequest = require('<path-to-your-utility-file>/utilities').makeRequest;
        async function main() {
            try {
                const result = await makeRequest('GET', '/v1/payment_methods/us_visa_card/required_fields');
                console.log(result);
            } catch (error) {
                console.error('Error completing request', error);
            }
        }
    • PHP

      • <?php
        $path = $_SERVER['DOCUMENT_ROOT'];
        $path .= "/<path-to-your-utility-file>/utilities.php";
        include($path);
        try {
            $object = make_request('get', '/v1/payment_methods/us_visa_card/required_fields');
            var_dump($object);
        }
        catch (Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        from utilities import make_request
        payment_method_type = "us_visa_card" 
        response = make_request(method='get', path=f'/v1/payment_methods/{payment_method_type}/required_fields/') 
        
        pprint(response)
  • /v1/payment_methods/:type/required_fields

  • Card

  • curl - X get https: //sandboxapi.rapyd.net/v1/payment_methods/us_visa_card/required_fields
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
    	"status": {
    		"error_code": "",
    		"status": "SUCCESS",
    		"message": "",
    		"response_code": "",
    		"operation_id": "80df644d-c428-4588-9f18-9698a25bbe5d"
    	},
    	"data": {
    		"type": "us_visa_card",
    		"fields": [
    			{
    				"name": "number",
    				"type": "string",
    				"regex": "",
    				"is_required": true,
    				"instructions": "card number"
    			},
    			{
    				"name": "expiration_month",
    				"type": "string",
    				"regex": "",
    				"is_required": true,
    				"instructions": "expiration month as string, 01-12"
    			},
    			{
    				"name": "expiration_year",
    				"type": "string",
    				"regex": "",
    				"is_required": true,
    				"instructions": "expiration year in to digits as string, 18-99"
    			},
    			{
    				"name": "cvv",
    				"type": "string",
    				"regex": "",
    				"is_required": false,
    				"instructions": "card cvv"
    			},
    			{
    				"name": "name",
    				"type": "string",
    				"regex": "",
    				"is_required": false,
    				"instructions": "card holder name"
    			},
    			{
    				"name": "address",
    				"type": "Address",
    				"regex": "",
    				"is_required": false,
    				"instructions": "card billing address. see Address object for more details"
    			}
    		],
    		"payment_method_options": [
    			{
    				"name": "3d_required",
    				"type": "string",
    				"regex": "",
    				"description": "",
    				"is_required": false,
    				"is_updatable": false
    			}
    		],
    		"payment_options": [
    			{
    				"name": "customer",
    				"type": "customer",
    				"regex": "",
    				"description": "make sure a customer was created with first_name, last_name and email",
    				"is_required": true,
    				"is_updatable": false
    			}
    		],
    		"minimum_expiration_seconds": null,
    		"maximum_expiration_seconds": null
    	}
    }
  • Cash

  • curl - X get https: //sandboxapi.rapyd.net/v1/payment_methods/it_psc_cash/required_fields
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
    	"status": {
    		"error_code": "",
    		"status": "SUCCESS",
    		"message": "",
    		"response_code": "",
    		"operation_id": "48d8e711-69ad-46b7-804c-d3c06fdb262b"
    	},
    	"data": {
    		"type": "it_psc_cash",
    		"fields": [],
    		"payment_method_options": [],
    		"payment_options": [],
    		"minimum_expiration_seconds": null,
    		"maximum_expiration_seconds": null
    	}
    }
  • Bank Transfer

  • curl - X get https: //sandboxapi.rapyd.net/v1/payment_methods/us_ach_bank/required_fields
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
    	"status": {
    		"error_code": "",
    		"status": "SUCCESS",
    		"message": "",
    		"response_code": "",
    		"operation_id": "6027b9d1-f40a-481e-a89e-4934290222db"
    	},
    	"data": {
    		"type": "us_ach_bank",
    		"fields": [
    			{
    				"name": "proof_of_authorization",
    				"type": "boolean",
    				"regex": "",
    				"description": "Indicates that the requester has received authorization from the payor.",
    				"is_required": true,
    				"is_updatable": false
    			},
    			{
    				"name": "first_name",
    				"type": "string",
    				"regex": "",
    				"description": "First name of the payor.",
    				"is_required": false,
    				"is_updatable": false
    			},
    			{
    				"name": "last_name",
    				"type": "string",
    				"regex": "",
    				"description": "Last name of the payor.",
    				"is_required": false,
    				"is_updatable": false
    			},
    			{
    				"name": "company_name",
    				"type": "string",
    				"regex": "",
    				"description": "Company name, when the payor is a business organization.",
    				"is_required": false,
    				"is_updatable": false
    			},
    			{
    				"name": "routing_number",
    				"type": "string",
    				"regex": "^([0-9]){9,9}$",
    				"description": "Bank routing number.",
    				"is_required": true,
    				"is_updatable": false
    			},
    			{
    				"name": "payment_purpose",
    				"type": "string",
    				"regex": "(PAYMENT|VENDOR PMT)",
    				"description": "Purpose of the payment.",
    				"is_required": true,
    				"is_updatable": false
    			},
    			{
    				"name": "account_number",
    				"type": "string",
    				"regex": "^([0-9]){1,34}$",
    				"description": "The payors bank account number.",
    				"is_required": true,
    				"is_updatable": false
    			}
    		],
    		"payment_method_options": [],
    		"payment_options": [],
    		"minimum_expiration_seconds": null,
    		"maximum_expiration_seconds": null
    	}
    }
  • Customer with Required Fields

  • curl - X get https: //sandboxapi.rapyd.net/v1/payment_methods/gb_trustly_bank/required_fields
    -H 'access_key: your-access-key-here'
    -H 'Content-Type: application/json'
    -H 'salt: your-random-string-here'
    -H 'signature: your-calculated-signature-here'
    -H 'timestamp: your-unix-timestamp-here'
    
  • {
    	"status": {
    		"error_code": "",
    		"status": "SUCCESS",
    		"message": "",
    		"response_code": "",
    		"operation_id": "5f25e66f-e7e7-49c5-bb9e-a7c68734adfc"
    	},
    	"data": {
    		"type": "gb_trustly_bank",
    		"fields": [],
    		"payment_method_options": [],
    		"payment_options": [
    			{
    				"name": "customer",
    				"type": "customer",
    				"regex": "",
    				"description": "ID of a customer object, a string starting with ‘cus_‘. The customer object must contain the fields listed as required, and can contain additional fields listed here.If the customer object does not exist yet, use ‘Create Customer‘",
    				"is_required": true,
    				"is_updatable": false,
    				"required_fields": [
    					{
    						"name": "name",
    						"type": "string",
    						"regex": "^[0-9a-zA-Z ]{1,128}$",
    						"description": "Customer’s full name",
    						"is_required": true,
    						"is_updatable": false
    					},
    					{
    						"name": "email",
    						"type": "string",
    						"regex": "^(?=.{1,100}$)([0-9a-zA-Z_]+@[a-zA-Z_]+?[.]{1}[a-zA-Z]{2,3})$",
    						"description": "Customer’s Email",
    						"is_required": true,
    						"is_updatable": false
    					}
    				]
    			}
    		],
    		"minimum_expiration_seconds": 0,
    		"maximum_expiration_seconds": 1209600
    	}
    }