Payments - Check Balance and Apply PM Data
curl --request POST \
--url https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--data '
{
"payment_methods": [
{
"gift_card": {
"givex": {
"number": "<string>",
"cvc": "<string>"
}
}
}
]
}
'import requests
url = "https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data"
payload = { "payment_methods": [{ "gift_card": { "givex": {
"number": "<string>",
"cvc": "<string>"
} } }] }
headers = {
"X-Profile-Id": "<x-profile-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Profile-Id': '<x-profile-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({payment_methods: [{gift_card: {givex: {number: '<string>', cvc: '<string>'}}}]})
};
fetch('https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data', 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/payments/{id}/eligibility/check-balance-and-apply-pm-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payment_methods' => [
[
'gift_card' => [
'givex' => [
'number' => '<string>',
'cvc' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data"
payload := strings.NewReader("{\n \"payment_methods\": [\n {\n \"gift_card\": {\n \"givex\": {\n \"number\": \"<string>\",\n \"cvc\": \"<string>\"\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payment_methods\": [\n {\n \"gift_card\": {\n \"givex\": {\n \"number\": \"<string>\",\n \"cvc\": \"<string>\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payment_methods\": [\n {\n \"gift_card\": {\n \"givex\": {\n \"number\": \"<string>\",\n \"cvc\": \"<string>\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"balances": [
{
"payment_method_data": {
"gift_card": {
"givex": {
"number": "<string>",
"cvc": "<string>"
}
}
},
"eligibility": {
"success": {
"balance": 123,
"applicable_amount": 123,
"currency": "AED"
}
}
}
],
"remaining_amount": 123,
"currency": "AED",
"requires_additional_pm_data": true,
"surcharge_details": [
{
"payment_method_type": "card",
"payment_method_subtype": "ach",
"surcharge_details": {
"surcharge": {
"type": "fixed",
"value": 123
},
"display_surcharge_amount": 123,
"display_tax_on_surcharge_amount": 123,
"display_total_surcharge_amount": 123,
"tax_on_surcharge": {
"percentage": 123
},
"surcharge_percentage": 123,
"error_details": {
"error_code": "INVALID_NICN",
"error_message": "Card BIN is invalid",
"error_reason": "<string>"
}
}
}
]
}Payments
Payments - Check Balance and Apply PM Data
Check the balance of the payment methods, apply the payment method data and recalculate remaining_amount and surcharge
POST
/
v2
/
payments
/
{id}
/
eligibility
/
check-balance-and-apply-pm-data
Payments - Check Balance and Apply PM Data
curl --request POST \
--url https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--data '
{
"payment_methods": [
{
"gift_card": {
"givex": {
"number": "<string>",
"cvc": "<string>"
}
}
}
]
}
'import requests
url = "https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data"
payload = { "payment_methods": [{ "gift_card": { "givex": {
"number": "<string>",
"cvc": "<string>"
} } }] }
headers = {
"X-Profile-Id": "<x-profile-id>",
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {
'X-Profile-Id': '<x-profile-id>',
Authorization: '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({payment_methods: [{gift_card: {givex: {number: '<string>', cvc: '<string>'}}}]})
};
fetch('https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data', 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/payments/{id}/eligibility/check-balance-and-apply-pm-data",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "POST",
CURLOPT_POSTFIELDS => json_encode([
'payment_methods' => [
[
'gift_card' => [
'givex' => [
'number' => '<string>',
'cvc' => '<string>'
]
]
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"Content-Type: application/json",
"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"
"strings"
"net/http"
"io"
)
func main() {
url := "https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data"
payload := strings.NewReader("{\n \"payment_methods\": [\n {\n \"gift_card\": {\n \"givex\": {\n \"number\": \"<string>\",\n \"cvc\": \"<string>\"\n }\n }\n }\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
req.Header.Add("Authorization", "<api-key>")
req.Header.Add("Content-Type", "application/json")
res, _ := http.DefaultClient.Do(req)
defer res.Body.Close()
body, _ := io.ReadAll(res.Body)
fmt.Println(string(body))
}HttpResponse<String> response = Unirest.post("https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data")
.header("X-Profile-Id", "<x-profile-id>")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"payment_methods\": [\n {\n \"gift_card\": {\n \"givex\": {\n \"number\": \"<string>\",\n \"cvc\": \"<string>\"\n }\n }\n }\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.hyperswitch.io/v2/payments/{id}/eligibility/check-balance-and-apply-pm-data")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["X-Profile-Id"] = '<x-profile-id>'
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"payment_methods\": [\n {\n \"gift_card\": {\n \"givex\": {\n \"number\": \"<string>\",\n \"cvc\": \"<string>\"\n }\n }\n }\n ]\n}"
response = http.request(request)
puts response.read_body{
"balances": [
{
"payment_method_data": {
"gift_card": {
"givex": {
"number": "<string>",
"cvc": "<string>"
}
}
},
"eligibility": {
"success": {
"balance": 123,
"applicable_amount": 123,
"currency": "AED"
}
}
}
],
"remaining_amount": 123,
"currency": "AED",
"requires_additional_pm_data": true,
"surcharge_details": [
{
"payment_method_type": "card",
"payment_method_subtype": "ach",
"surcharge_details": {
"surcharge": {
"type": "fixed",
"value": 123
},
"display_surcharge_amount": 123,
"display_tax_on_surcharge_amount": 123,
"display_total_surcharge_amount": 123,
"tax_on_surcharge": {
"percentage": 123
},
"surcharge_percentage": 123,
"error_details": {
"error_code": "INVALID_NICN",
"error_message": "Card BIN is invalid",
"error_reason": "<string>"
}
}
}
]
}Authorizations
Format: publishable-key=<publishable-key>,client-secret=<client-secret>
Publishable keys are a type of keys that can be public and have limited scope of usage. Client Secret provide temporary access to singular data, such as access to a single customer object for a short period of time. This authentication scheme is used by the SDK.
Response
200 - application/json
Apply the Payment Method Data
The three-letter ISO 4217 currency code (e.g., "USD", "EUR") for the payment amount. This field is mandatory for creating a payment.
Available options:
AED, AFN, ALL, AMD, ANG, AOA, ARS, AUD, AWG, AZN, BAM, BBD, BDT, BGN, BHD, BIF, BMD, BND, BOB, BRL, BSD, BTN, BWP, BYN, BZD, CAD, CDF, CHF, CLF, CLP, CNY, COP, CRC, CUC, CUP, CVE, CZK, DJF, DKK, DOP, DZD, EGP, ERN, ETB, EUR, FJD, FKP, GBP, GEL, GHS, GIP, GMD, GNF, GTQ, GYD, HKD, HNL, HRK, HTG, HUF, IDR, ILS, INR, IQD, IRR, ISK, JMD, JOD, JPY, KES, KGS, KHR, KMF, KPW, KRW, KWD, KYD, KZT, LAK, LBP, LKR, LRD, LSL, LYD, MAD, MDL, MGA, MKD, MMK, MNT, MOP, MRU, MUR, MVR, MWK, MXN, MYR, MZN, NAD, NGN, NIO, NOK, NPR, NZD, OMR, PAB, PEN, PGK, PHP, PKR, PLN, PYG, QAR, RON, RSD, RUB, RWF, SAR, SBD, SCR, SDG, SEK, SGD, SHP, SLE, SLL, SOS, SRD, SSP, STD, STN, SVC, SYP, SZL, THB, TJS, TMT, TND, TOP, TRY, TTD, TWD, TZS, UAH, UGX, USD, UYU, UZS, VES, VND, VUV, WST, XAF, XCD, XOF, XPF, YER, ZAR, ZMW, ZWL Was this page helpful?