Payment Method - List Customer Saved Payment Methods
curl --request GET \
--url https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods \
--header 'Authorization: <api-key>' \
--header 'X-Profile-Id: <x-profile-id>'import requests
url = "https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods"
headers = {
"X-Profile-Id": "<x-profile-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Profile-Id': '<x-profile-id>', Authorization: '<api-key>'}
};
fetch('https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-Profile-Id: <x-profile-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"customer_payment_methods": [
{
"id": "0a_pm_01926c58bc6e77c09e809964e72af8c8",
"customer_id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
"payment_method_type": "card",
"created": "2023-01-18T11:04:09.922Z",
"requires_cvv": true,
"is_default": true,
"merchant_customer_reference_id": "merchant_customer_123",
"payment_method_subtype": "ach",
"recurring_enabled": true,
"payment_method_data": {
"card": {
"saved_to_locker": true,
"issuer_country": "AF",
"last4_digits": "4242",
"expiry_month": "10",
"expiry_year": "25",
"card_holder_name": "John Doe",
"card_fingerprint": "fingerprint_12345",
"nick_name": "Card",
"card_network": "Visa",
"card_isin": "4567890",
"card_issuer": "Issuer Bank",
"card_type": "Credit",
"card_subtype": "CLASSIC",
"card_segment_type": "business",
"funding_source": "CREDIT"
}
},
"last_used_at": "2024-02-24T11:04:09.922Z",
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe",
"origin_zip": "08807"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
},
"network_tokenization": {
"payment_method_data": {
"last4_digits": "4242",
"issuer_country": "AF",
"network_token_expiry_month": "05",
"network_token_expiry_year": "27",
"nick_name": "Card",
"card_holder_name": "John Doe",
"card_isin": "16712672",
"card_issuer": "Bank of America",
"card_network": "Visa",
"card_type": "Credit",
"saved_to_locker": true,
"par": "522134KAVJ1JPZ8L77N0Z2LRYZS7J"
}
},
"connector_tokens": [
{
"token": "pm_9UhMqBMEOooRIvJFFdeW",
"connector_token_request_reference_id": "<string>"
}
],
"network_transaction_id": "<string>"
}
]
}Payment Methods
Payment Method - List Customer Saved Payment Methods
List the payment methods saved for a customer
GET
/
v2
/
customers
/
{id}
/
saved-payment-methods
Payment Method - List Customer Saved Payment Methods
curl --request GET \
--url https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods \
--header 'Authorization: <api-key>' \
--header 'X-Profile-Id: <x-profile-id>'import requests
url = "https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods"
headers = {
"X-Profile-Id": "<x-profile-id>",
"Authorization": "<api-key>"
}
response = requests.get(url, headers=headers)
print(response.text)const options = {
method: 'GET',
headers: {'X-Profile-Id': '<x-profile-id>', Authorization: '<api-key>'}
};
fetch('https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "GET",
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"X-Profile-Id: <x-profile-id>"
],
]);
$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);
if ($err) {
echo "cURL Error #:" . $err;
} else {
echo $response;
}package main
import (
"fmt"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods"
req, _ := http.NewRequest("GET", url, nil)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("Authorization", "<api-key>")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.get("https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v2/customers/{id}/saved-payment-methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["Authorization"] = '<api-key>'
response = http.request(request)
puts response.read_body{
"customer_payment_methods": [
{
"id": "0a_pm_01926c58bc6e77c09e809964e72af8c8",
"customer_id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
"payment_method_type": "card",
"created": "2023-01-18T11:04:09.922Z",
"requires_cvv": true,
"is_default": true,
"merchant_customer_reference_id": "merchant_customer_123",
"payment_method_subtype": "ach",
"recurring_enabled": true,
"payment_method_data": {
"card": {
"saved_to_locker": true,
"issuer_country": "AF",
"last4_digits": "4242",
"expiry_month": "10",
"expiry_year": "25",
"card_holder_name": "John Doe",
"card_fingerprint": "fingerprint_12345",
"nick_name": "Card",
"card_network": "Visa",
"card_isin": "4567890",
"card_issuer": "Issuer Bank",
"card_type": "Credit",
"card_subtype": "CLASSIC",
"card_segment_type": "business",
"funding_source": "CREDIT"
}
},
"last_used_at": "2024-02-24T11:04:09.922Z",
"billing": {
"address": {
"city": "New York",
"country": "AF",
"line1": "123, King Street",
"line2": "Powelson Avenue",
"line3": "Bridgewater",
"zip": "08807",
"state": "New York",
"first_name": "John",
"last_name": "Doe",
"origin_zip": "08807"
},
"phone": {
"number": "9123456789",
"country_code": "+1"
},
"email": "<string>"
},
"network_tokenization": {
"payment_method_data": {
"last4_digits": "4242",
"issuer_country": "AF",
"network_token_expiry_month": "05",
"network_token_expiry_year": "27",
"nick_name": "Card",
"card_holder_name": "John Doe",
"card_isin": "16712672",
"card_issuer": "Bank of America",
"card_network": "Visa",
"card_type": "Credit",
"saved_to_locker": true,
"par": "522134KAVJ1JPZ8L77N0Z2LRYZS7J"
}
},
"connector_tokens": [
{
"token": "pm_9UhMqBMEOooRIvJFFdeW",
"connector_token_request_reference_id": "<string>"
}
],
"network_transaction_id": "<string>"
}
]
}Authorizations
Was this page helpful?