curl --request GET \
--url https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id} \
--header 'Authorization: <api-key>' \
--header 'X-Profile-Id: <x-profile-id>'import requests
url = "https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id}"
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/v1/payment-method-sessions/{id}', 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/v1/payment-method-sessions/{id}",
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/v1/payment-method-sessions/{id}"
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/v1/payment-method-sessions/{id}")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id}")
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{
"id": "0a_pms_01926c58bc6e77c09e809964e72af8c8",
"expires_at": "2023-01-18T11:04:09.922Z",
"client_secret": "cs_9wcXDRVkfEtLEsSnYKgQ",
"storage_type": "volatile",
"keep_alive": true,
"customer_id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
"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": {
"enable": "Enable"
},
"tokenization_data": "<unknown>",
"return_url": "https://merchant-website.com/return",
"next_action": {
"redirect_to_url": "https://example.com/redirect",
"type": "redirect_to_url"
},
"authentication_details": {
"status": "succeeded",
"error": {
"code": "card_declined",
"message": "The card was declined.",
"reason": "The card was declined.",
"unified_code": "card_declined",
"unified_message": "The card was declined.",
"network_advice_code": "01",
"network_decline_code": "05",
"network_error_message": "Do not retry"
}
},
"associated_payment_methods": [
{
"payment_method_token": {
"type": "payment_method_session_token",
"data": "token_9wcXDRVkfEtLEsSnYKgQ"
}
}
],
"associated_token_id": "0a_tok_01926c58bc6e77c09e809964e72af8c8",
"card_cvc_token_storage": {
"is_stored": true,
"expires_at": "2024-02-24T11:04:09.922Z"
},
"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"
}
},
"sdk_authorization": "cHJvZmlsZV9pZD0uLi4=",
"network_tokenization_data": {
"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"
}
},
"external_vault_details": {
"vgs": {
"external_vault_id": "<string>",
"sdk_env": "<string>"
}
}
}Payment Method Session - Retrieve
Retrieve the payment method session
curl --request GET \
--url https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id} \
--header 'Authorization: <api-key>' \
--header 'X-Profile-Id: <x-profile-id>'import requests
url = "https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id}"
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/v1/payment-method-sessions/{id}', 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/v1/payment-method-sessions/{id}",
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/v1/payment-method-sessions/{id}"
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/v1/payment-method-sessions/{id}")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v1/payment-method-sessions/{id}")
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{
"id": "0a_pms_01926c58bc6e77c09e809964e72af8c8",
"expires_at": "2023-01-18T11:04:09.922Z",
"client_secret": "cs_9wcXDRVkfEtLEsSnYKgQ",
"storage_type": "volatile",
"keep_alive": true,
"customer_id": "0a_cus_01926c58bc6e77c09e809964e72af8c8",
"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": {
"enable": "Enable"
},
"tokenization_data": "<unknown>",
"return_url": "https://merchant-website.com/return",
"next_action": {
"redirect_to_url": "https://example.com/redirect",
"type": "redirect_to_url"
},
"authentication_details": {
"status": "succeeded",
"error": {
"code": "card_declined",
"message": "The card was declined.",
"reason": "The card was declined.",
"unified_code": "card_declined",
"unified_message": "The card was declined.",
"network_advice_code": "01",
"network_decline_code": "05",
"network_error_message": "Do not retry"
}
},
"associated_payment_methods": [
{
"payment_method_token": {
"type": "payment_method_session_token",
"data": "token_9wcXDRVkfEtLEsSnYKgQ"
}
}
],
"associated_token_id": "0a_tok_01926c58bc6e77c09e809964e72af8c8",
"card_cvc_token_storage": {
"is_stored": true,
"expires_at": "2024-02-24T11:04:09.922Z"
},
"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"
}
},
"sdk_authorization": "cHJvZmlsZV9pZD0uLi4=",
"network_tokenization_data": {
"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"
}
},
"external_vault_details": {
"vgs": {
"external_vault_id": "<string>",
"sdk_env": "<string>"
}
}
}Authorizations
Format: api-key=<api_key>
Use the API key created under your merchant account from the HyperSwitch dashboard. API key is used to authenticate API requests from your merchant server only. Don't expose this key on a website or embed it in a mobile application.
Headers
Profile ID associated to the payment method session
Path Parameters
The unique identifier for the Payment Method Session
Response
The payment method session is retrieved successfully
"0a_pms_01926c58bc6e77c09e809964e72af8c8"
The iso timestamp when the session will expire Trying to retrieve the session or any operations on the session after this time will result in an error
"2023-01-18T11:04:09.922Z"
Client Secret
"cs_9wcXDRVkfEtLEsSnYKgQ"
volatile, persistent Whether the card with new status should be listed in the session
The customer id for which the payment methods session is to be created
"0a_cus_01926c58bc6e77c09e809964e72af8c8"
Show child attributes
Show child attributes
The network tokenization configuration for creating the payment method session
Show child attributes
Show child attributes
Contains data to be passed on to tokenization service ( if present ) to create token_id for given JSON data
The return url to which the user should be redirected to
"https://merchant-website.com/return"
Contains the url for redirection flow
- Option 1
- Option 2
- Option 3
- Option 4
- Option 5
- Option 6
- Option 7
- Option 8
- Option 9
- Option 10
- Option 11
- Option 12
- Option 13
- Option 14
Show child attributes
Show child attributes
Show child attributes
Show child attributes
The payment method that was created using this payment method session
Show child attributes
Show child attributes
The token-id created if there is tokenization_data present
"0a_tok_01926c58bc6e77c09e809964e72af8c8"
Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
SDK authorization token for client SDK usage Contains encoded authentication details for subsequent API calls
"cHJvZmlsZV9pZD0uLi4="
Show child attributes
Show child attributes
- Option 1
- Option 2
Show child attributes
Show child attributes
Was this page helpful?