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
Retrieve Payment Method - Cash
curl -X get 'https://sandboxapi.rapyd.net/v1/customers/cus_4e25112ac20e144ad073a614dc46934b/payment_methods/other_0bfa8ede2535263dab8da20a384d5c2f' \ -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": "98c3c4e4-8e39-42e3-afce-cff0dc481218" }, "data": { "id": "other_0bfa8ede2535263dab8da20a384d5c2f", "type": "pe_banco_ripley_cash", "category": "cash", "metadata": {}, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable" } }
Retrieve Payment Method - Bank Redirect
curl -X get 'https://sandboxapi.rapyd.net/v1//customers/cus_4e25112ac20e144ad073a614dc46934b/payment_methods/other_c2cda8224983ff286fec562292f9950f' \ -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": "f341cd8c-d0f4-4826-a517-f183ec6b9d3a" }, "data": { "id": "other_c2cda8224983ff286fec562292f9950f", "type": "at_sofort_bank", "category": "bank_redirect", "metadata": {}, "image": "", "webhook_url": "", "supporting_documentation": "", "next_action": "not_applicable", "bic_swift": "", "account_last4": "" } }