Skip to main content

Documentation

Retrieve Payment Method

Retrieve a payment method for a specific customer.

You can retrieve all of the customer’s payment methods by omitting the payment_method_id path parameter.

    • customer

    • ID of the customer. String starting with cus_.

    • payment_method

    • ID of the payment method to update. String starting with card_ or other_.

Code Samples
    • .NET

      • using System;
        
        namespace RapydApiRequestSample
        {
            class Program
            {
                static void Main(string[] args)
                {
                    try
                    {
                        string customerId = "cus_478a0ffb8ad771c1bf9736e4b9e2b5f1";
                        string paymentMethod = "other_ab7bec8e250bead366f13ca34b130c39";
        
                        string result = RapydApiRequestSample.Utilities.MakeRequest("POST", $"/v1/customers/{customerId}/payment_methods/{paymentMethod}");
        
                        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/customers/cus_478a0ffb8ad771c1bf9736e4b9e2b5f1/payment_methods/other_ab7bec8e250bead366f13ca34b130c39'
            );
        
            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/customers/cus_478a0ffb8ad771c1bf9736e4b9e2b5f1/payment_methods/other_ab7bec8e250bead366f13ca34b130c39");
            var_dump($object);
        } catch (Exception $e) {
            echo "Error: $e";
        }
        ?>
    • Python

      • from pprint import pprint
        
        from utilities import make_request
        
        # Retrieve Payment Method
        result = make_request(method='get',
                              path='/v1/customers/cus_478a0ffb8ad771c1bf9736e4b9e2b5f1/payment_methods/other_ab7bec8e250bead366f13ca34b130c39')
        pprint(result)
  • /v1/customers/:customer/payment_methods/:payment_method

  • Cash

  • curl -X get
    https://sandboxapi.rapyd.net/v1//customers/cus_e467136cc0d5ab97ff2c3cbcda43a658/payment_methods/other_6b0709a10cbaa0c120d6e03de5b646c5
    -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": "cb2b03e5-c598-49b5-b8ae-cc2ccea91193"
        },
        "data": {
            "id": "other_6b0709a10cbaa0c120d6e03de5b646c5",
            "type": "it_psc_cash",
            "category": "cash",
            "metadata": {
                "merchant_defined": true
            },
            "image": "",
            "webhook_url": "",
            "supporting_documentation": "",
            "next_action": "not_applicable"
        }
    }
  • Bank redirect

  • curl -X get
    https://sandboxapi.rapyd.net/v1//customers/cus_e467136cc0d5ab97ff2c3cbcda43a658/payment_methods/other_e1c5d34df2125607ca08978929c3dd8f
    -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": "0c6128d6-9928-4e45-a7b5-724421a69f8c"
        },
        "data": {
            "id": "other_e1c5d34df2125607ca08978929c3dd8f",
            "type": "fi_sepadirectdebit_bank",
            "category": "bank_redirect",
            "metadata": {
                "merchant_defined": true
            },
            "image": "",
            "webhook_url": "",
            "supporting_documentation": "",
            "next_action": "not_applicable",
            "bic_swift": "ABCDEFG1234",
            "account_last4": "6283",
            "language": "es"
        }
    }