Use the below endpoint to fetch all tokens linked to a customer.
A customer can have multiple tokens tied to them. These tokens can be used to create subsequent payments for multiple products or services.
Curl PHP Node.JS Python Go Response
Copy curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \
-X GET https://api.razorpay.com/v1/customers/cust_1Aa00000000002/tokens
Copy $api = new Api($key_id , $secret );
$api ->customer->fetch($customerId )->tokens()->all();
Copy var instance = new Razorpay ({ key_id : 'YOUR_KEY_ID' , key_secret : 'YOUR_SECRET' })
instance.customers .fetchTokens (customerId)
Copy client = razorpay.Client(auth=("YOUR_ID" , "YOUR_SECRET" ))
client.token.all (customerId)
Copy import ( razorpay "github.com/razorpay/razorpay-go" )
client := razorpay.NewClient("YOUR_KEY_ID" , "YOUR_SECRET" )
body, err := client.Token.All("<customerId>" , nil , nil )
Copy {
"entity" : "collection" ,
"count" : 2 ,
"items" : [
{
"id" : "token_FHf94Uym9tdYFJ" ,
"entity" : "token" ,
"token" : "2wDPM7VAlXtjAR" ,
"bank" : "HDFC" ,
"wallet" : null ,
"method" : "emandate" ,
"vpa" : null ,
"recurring" : true ,
"recurring_details" : {
"status" : "confirmed" ,
"failure_reason" : null
} ,
"auth_type" : "netbanking" ,
"mrn" : null ,
"used_at" : 1595447381 ,
"created_at" : 1595447381 ,
"bank_details" : {
"beneficiary_name" : "Gaurav Kumar" ,
"account_number" : "1121431121541121" ,
"ifsc" : "HDFC0000001" ,
"account_type" : "savings"
} ,
"max_amount" : 9999900 ,
"expired_at" : 1689971140 ,
"dcc_enabled" : false
} ,
{
"id" : "token_FHf9aAZR9hWJkq" ,
"entity" : "token" ,
"token" : "AwAwIFBmDSJ4p6" ,
"bank" : "HDFC" ,
"wallet" : null ,
"method" : "emandate" ,
"vpa" : null ,
"recurring" : true ,
"recurring_details" : {
"status" : "confirmed" ,
"failure_reason" : null
} ,
"auth_type" : "debitcard" ,
"mrn" : null ,
"used_at" : 1595447410 ,
"created_at" : 1595447410 ,
"bank_details" : {
"beneficiary_name" : "Gaurav Kumar" ,
"account_number" : "1121431121541121" ,
"ifsc" : "HDFC0000001" ,
"account_type" : "savings"
} ,
"max_amount" : 9999900 ,
"expired_at" : 4102444799 ,
"dcc_enabled" : false
}
]
}