curl --request POST \
--url https://sandbox.birrpay.io/payment_methods \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"card": {
"card_exp_month": "11",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"card_number": "4242424242424242"
},
"customer_id": "{{customer_id}}",
"payment_method": "card",
"payment_method_issuer": "Visa",
"payment_method_type": "credit"
}
'import requests
url = "https://sandbox.birrpay.io/payment_methods"
payload = {
"card": {
"card_exp_month": "11",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"card_number": "4242424242424242"
},
"customer_id": "{{customer_id}}",
"payment_method": "card",
"payment_method_issuer": "Visa",
"payment_method_type": "credit"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
card: {
card_exp_month: '11',
card_exp_year: '25',
card_holder_name: 'John Doe',
card_number: '4242424242424242'
},
customer_id: '{{customer_id}}',
payment_method: 'card',
payment_method_issuer: 'Visa',
payment_method_type: 'credit'
})
};
fetch('https://sandbox.birrpay.io/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.birrpay.io/payment_methods",
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([
'card' => [
'card_exp_month' => '11',
'card_exp_year' => '25',
'card_holder_name' => 'John Doe',
'card_number' => '4242424242424242'
],
'customer_id' => '{{customer_id}}',
'payment_method' => 'card',
'payment_method_issuer' => 'Visa',
'payment_method_type' => 'credit'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$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.birrpay.io/payment_methods"
payload := strings.NewReader("{\n \"card\": {\n \"card_exp_month\": \"11\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"John Doe\",\n \"card_number\": \"4242424242424242\"\n },\n \"customer_id\": \"{{customer_id}}\",\n \"payment_method\": \"card\",\n \"payment_method_issuer\": \"Visa\",\n \"payment_method_type\": \"credit\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<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.birrpay.io/payment_methods")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"card\": {\n \"card_exp_month\": \"11\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"John Doe\",\n \"card_number\": \"4242424242424242\"\n },\n \"customer_id\": \"{{customer_id}}\",\n \"payment_method\": \"card\",\n \"payment_method_issuer\": \"Visa\",\n \"payment_method_type\": \"credit\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.birrpay.io/payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card\": {\n \"card_exp_month\": \"11\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"John Doe\",\n \"card_number\": \"4242424242424242\"\n },\n \"customer_id\": \"{{customer_id}}\",\n \"payment_method\": \"card\",\n \"payment_method_issuer\": \"Visa\",\n \"payment_method_type\": \"credit\"\n}"
response = http.request(request)
puts response.read_body{
"merchant_id": "merchant_1671528864",
"payment_method_id": "card_rGK4Vi5iSW70MY7J2mIg",
"payment_method": "card",
"customer_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"payment_method_type": "ach",
"card": {
"saved_to_locker": true,
"scheme": "<string>",
"issuer_country": "<string>",
"issuer_country_code": "<string>",
"last4_digits": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"card_token": "<string>",
"card_holder_name": "<string>",
"card_fingerprint": "<string>",
"nick_name": "<string>",
"card_network": "Visa",
"card_isin": "<string>",
"card_issuer": "<string>",
"card_type": "<string>"
},
"recurring_enabled": true,
"installment_payment_enabled": true,
"payment_experience": [
"redirect_to_url"
],
"metadata": {},
"created": "2023-01-18T11:04:09.922Z",
"bank_transfer": {
"bank_account_number": "000123456",
"bank_routing_number": "110000000",
"bank_name": "Deutsche Bank",
"bank_country_code": "AF",
"bank_city": "California"
},
"last_used_at": "2024-02-24T11:04:09.922Z",
"client_secret": "<string>"
}PaymentMethods - Create
Creates and stores a payment method against a customer. In case of cards, this API should be used only by PCI compliant merchants.
curl --request POST \
--url https://sandbox.birrpay.io/payment_methods \
--header 'Content-Type: application/json' \
--header 'api-key: <api-key>' \
--data '
{
"card": {
"card_exp_month": "11",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"card_number": "4242424242424242"
},
"customer_id": "{{customer_id}}",
"payment_method": "card",
"payment_method_issuer": "Visa",
"payment_method_type": "credit"
}
'import requests
url = "https://sandbox.birrpay.io/payment_methods"
payload = {
"card": {
"card_exp_month": "11",
"card_exp_year": "25",
"card_holder_name": "John Doe",
"card_number": "4242424242424242"
},
"customer_id": "{{customer_id}}",
"payment_method": "card",
"payment_method_issuer": "Visa",
"payment_method_type": "credit"
}
headers = {
"api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
card: {
card_exp_month: '11',
card_exp_year: '25',
card_holder_name: 'John Doe',
card_number: '4242424242424242'
},
customer_id: '{{customer_id}}',
payment_method: 'card',
payment_method_issuer: 'Visa',
payment_method_type: 'credit'
})
};
fetch('https://sandbox.birrpay.io/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.birrpay.io/payment_methods",
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([
'card' => [
'card_exp_month' => '11',
'card_exp_year' => '25',
'card_holder_name' => 'John Doe',
'card_number' => '4242424242424242'
],
'customer_id' => '{{customer_id}}',
'payment_method' => 'card',
'payment_method_issuer' => 'Visa',
'payment_method_type' => 'credit'
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"api-key: <api-key>"
],
]);
$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.birrpay.io/payment_methods"
payload := strings.NewReader("{\n \"card\": {\n \"card_exp_month\": \"11\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"John Doe\",\n \"card_number\": \"4242424242424242\"\n },\n \"customer_id\": \"{{customer_id}}\",\n \"payment_method\": \"card\",\n \"payment_method_issuer\": \"Visa\",\n \"payment_method_type\": \"credit\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("api-key", "<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.birrpay.io/payment_methods")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"card\": {\n \"card_exp_month\": \"11\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"John Doe\",\n \"card_number\": \"4242424242424242\"\n },\n \"customer_id\": \"{{customer_id}}\",\n \"payment_method\": \"card\",\n \"payment_method_issuer\": \"Visa\",\n \"payment_method_type\": \"credit\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.birrpay.io/payment_methods")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"card\": {\n \"card_exp_month\": \"11\",\n \"card_exp_year\": \"25\",\n \"card_holder_name\": \"John Doe\",\n \"card_number\": \"4242424242424242\"\n },\n \"customer_id\": \"{{customer_id}}\",\n \"payment_method\": \"card\",\n \"payment_method_issuer\": \"Visa\",\n \"payment_method_type\": \"credit\"\n}"
response = http.request(request)
puts response.read_body{
"merchant_id": "merchant_1671528864",
"payment_method_id": "card_rGK4Vi5iSW70MY7J2mIg",
"payment_method": "card",
"customer_id": "cus_y3oqhf46pyzuxjbcn2giaqnb44",
"payment_method_type": "ach",
"card": {
"saved_to_locker": true,
"scheme": "<string>",
"issuer_country": "<string>",
"issuer_country_code": "<string>",
"last4_digits": "<string>",
"expiry_month": "<string>",
"expiry_year": "<string>",
"card_token": "<string>",
"card_holder_name": "<string>",
"card_fingerprint": "<string>",
"nick_name": "<string>",
"card_network": "Visa",
"card_isin": "<string>",
"card_issuer": "<string>",
"card_type": "<string>"
},
"recurring_enabled": true,
"installment_payment_enabled": true,
"payment_experience": [
"redirect_to_url"
],
"metadata": {},
"created": "2023-01-18T11:04:09.922Z",
"bank_transfer": {
"bank_account_number": "000123456",
"bank_routing_number": "110000000",
"bank_name": "Deutsche Bank",
"bank_country_code": "AF",
"bank_city": "California"
},
"last_used_at": "2024-02-24T11:04:09.922Z",
"client_secret": "<string>"
}Authorizations
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.
Body
Indicates the type of payment method. Eg: 'card', 'wallet', etc.
card, card_redirect, pay_later, wallet, bank_redirect, bank_transfer, crypto, bank_debit, reward, real_time_payment, upi, voucher, gift_card, open_banking, mobile_payment, network_token Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.
ach, affirm, afterpay_clearpay, alfamart, ali_pay, ali_pay_hk, alma, amazon_pay, paysera, apple_pay, atome, bacs, bancontact_card, becs, benefit, bizum, blik, bluecode, boleto, bca_bank_transfer, bni_va, breadpay, bri_va, bhn_card_network, card_redirect, cimb_va, classic, credit, crypto_currency, cashapp, dana, danamon_va, debit, duit_now, efecty, eft, eps, flexiti, fps, evoucher, giropay, givex, google_pay, go_pay, gcash, ideal, interac, indomaret, klarna, kakao_pay, local_bank_redirect, mandiri_va, knet, mb_way, mobile_pay, momo, momo_atm, multibanco, online_banking_thailand, online_banking_czech_republic, online_banking_finland, online_banking_fpx, online_banking_poland, online_banking_slovakia, oxxo, pago_efectivo, permata_bank_transfer, open_banking_uk, pay_bright, payjustnow, paypal, paze, pix, pay_safe_card, przelewy24, prompt_pay, pse, qris, red_compra, red_pagos, samsung_pay, sepa, sepa_bank_transfer, sepa_guarenteed_debit, skrill, sofort, swish, touch_n_go, trustly, twint, upi_collect, upi_intent, upi_qr, vipps, viet_qr, venmo, walley, we_chat_pay, seven_eleven, lawson, mini_stop, family_mart, seicomart, pay_easy, local_bank_transfer, mifinity, open_banking_pis, direct_carrier_billing, instant_bank_transfer, instant_bank_transfer_finland, instant_bank_transfer_poland, revolut_pay, indonesian_bank_transfer, open_banking, network_token The name of the bank/ provider issuing the payment method to the end user
"Citibank"
jp_hdfc, jp_icici, jp_googlepay, jp_applepay, jp_phonepay, jp_wechat, jp_sofort, jp_giropay, jp_sepa, jp_bacs Show child attributes
Show child attributes
You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
The unique identifier of the customer.
1 - 64"cus_y3oqhf46pyzuxjbcn2giaqnb44"
The card network
"Visa"
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
- Option 1
- Option 2
- Option 3
Show child attributes
Show child attributes
For Client based calls, SDK will use the client_secret in order to call /payment_methods Client secret will be generated whenever a new payment method is created
- Option 1
- Option 2
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Response
Payment Method Created
Unique identifier for a merchant
"merchant_1671528864"
The unique identifier of the Payment method
"card_rGK4Vi5iSW70MY7J2mIg"
Indicates the type of payment method. Eg: 'card', 'wallet', etc.
card, card_redirect, pay_later, wallet, bank_redirect, bank_transfer, crypto, bank_debit, reward, real_time_payment, upi, voucher, gift_card, open_banking, mobile_payment, network_token The unique identifier of the customer.
1 - 64"cus_y3oqhf46pyzuxjbcn2giaqnb44"
Indicates the sub type of payment method. Eg: 'google_pay' & 'apple_pay' for wallets.
ach, affirm, afterpay_clearpay, alfamart, ali_pay, ali_pay_hk, alma, amazon_pay, paysera, apple_pay, atome, bacs, bancontact_card, becs, benefit, bizum, blik, bluecode, boleto, bca_bank_transfer, bni_va, breadpay, bri_va, bhn_card_network, card_redirect, cimb_va, classic, credit, crypto_currency, cashapp, dana, danamon_va, debit, duit_now, efecty, eft, eps, flexiti, fps, evoucher, giropay, givex, google_pay, go_pay, gcash, ideal, interac, indomaret, klarna, kakao_pay, local_bank_redirect, mandiri_va, knet, mb_way, mobile_pay, momo, momo_atm, multibanco, online_banking_thailand, online_banking_czech_republic, online_banking_finland, online_banking_fpx, online_banking_poland, online_banking_slovakia, oxxo, pago_efectivo, permata_bank_transfer, open_banking_uk, pay_bright, payjustnow, paypal, paze, pix, pay_safe_card, przelewy24, prompt_pay, pse, qris, red_compra, red_pagos, samsung_pay, sepa, sepa_bank_transfer, sepa_guarenteed_debit, skrill, sofort, swish, touch_n_go, trustly, twint, upi_collect, upi_intent, upi_qr, vipps, viet_qr, venmo, walley, we_chat_pay, seven_eleven, lawson, mini_stop, family_mart, seicomart, pay_easy, local_bank_transfer, mifinity, open_banking_pis, direct_carrier_billing, instant_bank_transfer, instant_bank_transfer_finland, instant_bank_transfer_poland, revolut_pay, indonesian_bank_transfer, open_banking, network_token Show child attributes
Show child attributes
Indicates whether the payment method supports recurring payments. Optional.
true
Indicates whether the payment method is eligible for installment payments (e.g., EMI, BNPL). Optional.
true
Type of payment experience enabled with the connector
To indicate the type of payment experience that the customer would go through
redirect_to_url, invoke_sdk_client, display_qr_code, one_click, link_wallet, invoke_payment_app, display_wait_screen, collect_otp ["redirect_to_url"]
You can specify up to 50 keys, with key names up to 40 characters long and values up to 500 characters long. Metadata is useful for storing additional, structured information on an object.
A timestamp (ISO 8601 code) that determines when the payment method was created
"2023-01-18T11:04:09.922Z"
- Option 1
- Option 2
- Option 3
- Option 4
Show child attributes
Show child attributes
"2024-02-24T11:04:09.922Z"
For Client based calls