curl --request POST \
--url https://sandbox.birrpay.io/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '
{
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"first_name": "joseph",
"last_name": "Doe",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"state": "California",
"zip": "94122"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
},
"customer_id": "cust_123456789",
"description": "Hello this is description",
"item_price_id": "standard-plan-USD-Monthly",
"merchant_reference_id": "mer_ref_123456789",
"payment_details": {
"authentication_type": "no_three_ds",
"capture_method": "automatic",
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"payment_method": "card",
"payment_method_data": {
"card": {
"card_cvc": "737",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "CLBRW dffdg",
"card_number": "4000000000000002"
}
},
"payment_method_type": "credit",
"payment_type": "setup_mandate",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
},
"shipping": {
"address": {
"city": "Banglore",
"country": "US",
"first_name": "joseph",
"last_name": "doe",
"line1": "sdsdfsdf",
"line2": "hsgdbhd",
"line3": "alsksoe",
"state": "zsaasdas",
"zip": "571201"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
}
}
'import requests
url = "https://sandbox.birrpay.io/subscriptions"
payload = {
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"first_name": "joseph",
"last_name": "Doe",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"state": "California",
"zip": "94122"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
},
"customer_id": "cust_123456789",
"description": "Hello this is description",
"item_price_id": "standard-plan-USD-Monthly",
"merchant_reference_id": "mer_ref_123456789",
"payment_details": {
"authentication_type": "no_three_ds",
"capture_method": "automatic",
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"payment_method": "card",
"payment_method_data": { "card": {
"card_cvc": "737",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "CLBRW dffdg",
"card_number": "4000000000000002"
} },
"payment_method_type": "credit",
"payment_type": "setup_mandate",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
},
"shipping": {
"address": {
"city": "Banglore",
"country": "US",
"first_name": "joseph",
"last_name": "doe",
"line1": "sdsdfsdf",
"line2": "hsgdbhd",
"line3": "alsksoe",
"state": "zsaasdas",
"zip": "571201"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
}
}
headers = {
"X-Profile-Id": "<x-profile-id>",
"api-key": "<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>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
billing: {
address: {
city: 'San Fransico',
country: 'US',
first_name: 'joseph',
last_name: 'Doe',
line1: '1467',
line2: 'Harrison Street',
line3: 'Harrison Street',
state: 'California',
zip: '94122'
},
phone: {country_code: '+1', number: '123456789'}
},
customer_id: 'cust_123456789',
description: 'Hello this is description',
item_price_id: 'standard-plan-USD-Monthly',
merchant_reference_id: 'mer_ref_123456789',
payment_details: {
authentication_type: 'no_three_ds',
capture_method: 'automatic',
customer_acceptance: {
acceptance_type: 'online',
accepted_at: '1963-05-03T04:07:52.723Z',
online: {ip_address: '127.0.0.1', user_agent: 'amet irure esse'}
},
payment_method: 'card',
payment_method_data: {
card: {
card_cvc: '737',
card_exp_month: '03',
card_exp_year: '2030',
card_holder_name: 'CLBRW dffdg',
card_number: '4000000000000002'
}
},
payment_method_type: 'credit',
payment_type: 'setup_mandate',
return_url: 'https://google.com',
setup_future_usage: 'off_session'
},
shipping: {
address: {
city: 'Banglore',
country: 'US',
first_name: 'joseph',
last_name: 'doe',
line1: 'sdsdfsdf',
line2: 'hsgdbhd',
line3: 'alsksoe',
state: 'zsaasdas',
zip: '571201'
},
phone: {country_code: '+1', number: '123456789'}
}
})
};
fetch('https://sandbox.birrpay.io/subscriptions', 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/subscriptions",
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([
'billing' => [
'address' => [
'city' => 'San Fransico',
'country' => 'US',
'first_name' => 'joseph',
'last_name' => 'Doe',
'line1' => '1467',
'line2' => 'Harrison Street',
'line3' => 'Harrison Street',
'state' => 'California',
'zip' => '94122'
],
'phone' => [
'country_code' => '+1',
'number' => '123456789'
]
],
'customer_id' => 'cust_123456789',
'description' => 'Hello this is description',
'item_price_id' => 'standard-plan-USD-Monthly',
'merchant_reference_id' => 'mer_ref_123456789',
'payment_details' => [
'authentication_type' => 'no_three_ds',
'capture_method' => 'automatic',
'customer_acceptance' => [
'acceptance_type' => 'online',
'accepted_at' => '1963-05-03T04:07:52.723Z',
'online' => [
'ip_address' => '127.0.0.1',
'user_agent' => 'amet irure esse'
]
],
'payment_method' => 'card',
'payment_method_data' => [
'card' => [
'card_cvc' => '737',
'card_exp_month' => '03',
'card_exp_year' => '2030',
'card_holder_name' => 'CLBRW dffdg',
'card_number' => '4000000000000002'
]
],
'payment_method_type' => 'credit',
'payment_type' => 'setup_mandate',
'return_url' => 'https://google.com',
'setup_future_usage' => 'off_session'
],
'shipping' => [
'address' => [
'city' => 'Banglore',
'country' => 'US',
'first_name' => 'joseph',
'last_name' => 'doe',
'line1' => 'sdsdfsdf',
'line2' => 'hsgdbhd',
'line3' => 'alsksoe',
'state' => 'zsaasdas',
'zip' => '571201'
],
'phone' => [
'country_code' => '+1',
'number' => '123456789'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Profile-Id: <x-profile-id>",
"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/subscriptions"
payload := strings.NewReader("{\n \"billing\": {\n \"address\": {\n \"city\": \"San Fransico\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"state\": \"California\",\n \"zip\": \"94122\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n },\n \"customer_id\": \"cust_123456789\",\n \"description\": \"Hello this is description\",\n \"item_price_id\": \"standard-plan-USD-Monthly\",\n \"merchant_reference_id\": \"mer_ref_123456789\",\n \"payment_details\": {\n \"authentication_type\": \"no_three_ds\",\n \"capture_method\": \"automatic\",\n \"customer_acceptance\": {\n \"acceptance_type\": \"online\",\n \"accepted_at\": \"1963-05-03T04:07:52.723Z\",\n \"online\": {\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"amet irure esse\"\n }\n },\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_cvc\": \"737\",\n \"card_exp_month\": \"03\",\n \"card_exp_year\": \"2030\",\n \"card_holder_name\": \"CLBRW dffdg\",\n \"card_number\": \"4000000000000002\"\n }\n },\n \"payment_method_type\": \"credit\",\n \"payment_type\": \"setup_mandate\",\n \"return_url\": \"https://google.com\",\n \"setup_future_usage\": \"off_session\"\n },\n \"shipping\": {\n \"address\": {\n \"city\": \"Banglore\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"doe\",\n \"line1\": \"sdsdfsdf\",\n \"line2\": \"hsgdbhd\",\n \"line3\": \"alsksoe\",\n \"state\": \"zsaasdas\",\n \"zip\": \"571201\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
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/subscriptions")
.header("X-Profile-Id", "<x-profile-id>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"billing\": {\n \"address\": {\n \"city\": \"San Fransico\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"state\": \"California\",\n \"zip\": \"94122\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n },\n \"customer_id\": \"cust_123456789\",\n \"description\": \"Hello this is description\",\n \"item_price_id\": \"standard-plan-USD-Monthly\",\n \"merchant_reference_id\": \"mer_ref_123456789\",\n \"payment_details\": {\n \"authentication_type\": \"no_three_ds\",\n \"capture_method\": \"automatic\",\n \"customer_acceptance\": {\n \"acceptance_type\": \"online\",\n \"accepted_at\": \"1963-05-03T04:07:52.723Z\",\n \"online\": {\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"amet irure esse\"\n }\n },\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_cvc\": \"737\",\n \"card_exp_month\": \"03\",\n \"card_exp_year\": \"2030\",\n \"card_holder_name\": \"CLBRW dffdg\",\n \"card_number\": \"4000000000000002\"\n }\n },\n \"payment_method_type\": \"credit\",\n \"payment_type\": \"setup_mandate\",\n \"return_url\": \"https://google.com\",\n \"setup_future_usage\": \"off_session\"\n },\n \"shipping\": {\n \"address\": {\n \"city\": \"Banglore\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"doe\",\n \"line1\": \"sdsdfsdf\",\n \"line2\": \"hsgdbhd\",\n \"line3\": \"alsksoe\",\n \"state\": \"zsaasdas\",\n \"zip\": \"571201\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.birrpay.io/subscriptions")
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["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"billing\": {\n \"address\": {\n \"city\": \"San Fransico\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"state\": \"California\",\n \"zip\": \"94122\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n },\n \"customer_id\": \"cust_123456789\",\n \"description\": \"Hello this is description\",\n \"item_price_id\": \"standard-plan-USD-Monthly\",\n \"merchant_reference_id\": \"mer_ref_123456789\",\n \"payment_details\": {\n \"authentication_type\": \"no_three_ds\",\n \"capture_method\": \"automatic\",\n \"customer_acceptance\": {\n \"acceptance_type\": \"online\",\n \"accepted_at\": \"1963-05-03T04:07:52.723Z\",\n \"online\": {\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"amet irure esse\"\n }\n },\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_cvc\": \"737\",\n \"card_exp_month\": \"03\",\n \"card_exp_year\": \"2030\",\n \"card_holder_name\": \"CLBRW dffdg\",\n \"card_number\": \"4000000000000002\"\n }\n },\n \"payment_method_type\": \"credit\",\n \"payment_type\": \"setup_mandate\",\n \"return_url\": \"https://google.com\",\n \"setup_future_usage\": \"off_session\"\n },\n \"shipping\": {\n \"address\": {\n \"city\": \"Banglore\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"doe\",\n \"line1\": \"sdsdfsdf\",\n \"line2\": \"hsgdbhd\",\n \"line3\": \"alsksoe\",\n \"state\": \"zsaasdas\",\n \"zip\": \"571201\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"profile_id": "<string>",
"merchant_id": "<string>",
"customer_id": "<string>",
"merchant_reference_id": "<string>",
"plan_id": "<string>",
"item_price_id": "<string>",
"client_secret": "<string>",
"coupon_code": "<string>",
"payment": {
"payment_id": "<string>",
"amount": 123,
"profile_id": "<string>",
"connector": "<string>",
"payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8",
"return_url": "<string>",
"next_action": {
"redirect_to_url": "<string>",
"type": "redirect_to_url"
},
"error_code": "<string>",
"error_message": "<string>",
"client_secret": "<string>",
"billing": {
"address": {
"city": "New York",
"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>"
},
"shipping": {
"address": {
"city": "New York",
"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>"
},
"payment_token": "token_sxJdmpUnpNsJk5VWzcjl"
},
"invoice": {
"id": "<string>",
"subscription_id": "<string>",
"merchant_id": "<string>",
"profile_id": "<string>",
"merchant_connector_id": "<string>",
"customer_id": "<string>",
"amount": 123,
"payment_intent_id": "<string>",
"payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8",
"billing_processor_invoice_id": "<string>"
}
}Subscription - Create and Confirm
Creates and confirms a subscription in a single request.
curl --request POST \
--url https://sandbox.birrpay.io/subscriptions \
--header 'Content-Type: application/json' \
--header 'X-Profile-Id: <x-profile-id>' \
--header 'api-key: <api-key>' \
--data '
{
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"first_name": "joseph",
"last_name": "Doe",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"state": "California",
"zip": "94122"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
},
"customer_id": "cust_123456789",
"description": "Hello this is description",
"item_price_id": "standard-plan-USD-Monthly",
"merchant_reference_id": "mer_ref_123456789",
"payment_details": {
"authentication_type": "no_three_ds",
"capture_method": "automatic",
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"payment_method": "card",
"payment_method_data": {
"card": {
"card_cvc": "737",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "CLBRW dffdg",
"card_number": "4000000000000002"
}
},
"payment_method_type": "credit",
"payment_type": "setup_mandate",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
},
"shipping": {
"address": {
"city": "Banglore",
"country": "US",
"first_name": "joseph",
"last_name": "doe",
"line1": "sdsdfsdf",
"line2": "hsgdbhd",
"line3": "alsksoe",
"state": "zsaasdas",
"zip": "571201"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
}
}
'import requests
url = "https://sandbox.birrpay.io/subscriptions"
payload = {
"billing": {
"address": {
"city": "San Fransico",
"country": "US",
"first_name": "joseph",
"last_name": "Doe",
"line1": "1467",
"line2": "Harrison Street",
"line3": "Harrison Street",
"state": "California",
"zip": "94122"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
},
"customer_id": "cust_123456789",
"description": "Hello this is description",
"item_price_id": "standard-plan-USD-Monthly",
"merchant_reference_id": "mer_ref_123456789",
"payment_details": {
"authentication_type": "no_three_ds",
"capture_method": "automatic",
"customer_acceptance": {
"acceptance_type": "online",
"accepted_at": "1963-05-03T04:07:52.723Z",
"online": {
"ip_address": "127.0.0.1",
"user_agent": "amet irure esse"
}
},
"payment_method": "card",
"payment_method_data": { "card": {
"card_cvc": "737",
"card_exp_month": "03",
"card_exp_year": "2030",
"card_holder_name": "CLBRW dffdg",
"card_number": "4000000000000002"
} },
"payment_method_type": "credit",
"payment_type": "setup_mandate",
"return_url": "https://google.com",
"setup_future_usage": "off_session"
},
"shipping": {
"address": {
"city": "Banglore",
"country": "US",
"first_name": "joseph",
"last_name": "doe",
"line1": "sdsdfsdf",
"line2": "hsgdbhd",
"line3": "alsksoe",
"state": "zsaasdas",
"zip": "571201"
},
"phone": {
"country_code": "+1",
"number": "123456789"
}
}
}
headers = {
"X-Profile-Id": "<x-profile-id>",
"api-key": "<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>',
'api-key': '<api-key>',
'Content-Type': 'application/json'
},
body: JSON.stringify({
billing: {
address: {
city: 'San Fransico',
country: 'US',
first_name: 'joseph',
last_name: 'Doe',
line1: '1467',
line2: 'Harrison Street',
line3: 'Harrison Street',
state: 'California',
zip: '94122'
},
phone: {country_code: '+1', number: '123456789'}
},
customer_id: 'cust_123456789',
description: 'Hello this is description',
item_price_id: 'standard-plan-USD-Monthly',
merchant_reference_id: 'mer_ref_123456789',
payment_details: {
authentication_type: 'no_three_ds',
capture_method: 'automatic',
customer_acceptance: {
acceptance_type: 'online',
accepted_at: '1963-05-03T04:07:52.723Z',
online: {ip_address: '127.0.0.1', user_agent: 'amet irure esse'}
},
payment_method: 'card',
payment_method_data: {
card: {
card_cvc: '737',
card_exp_month: '03',
card_exp_year: '2030',
card_holder_name: 'CLBRW dffdg',
card_number: '4000000000000002'
}
},
payment_method_type: 'credit',
payment_type: 'setup_mandate',
return_url: 'https://google.com',
setup_future_usage: 'off_session'
},
shipping: {
address: {
city: 'Banglore',
country: 'US',
first_name: 'joseph',
last_name: 'doe',
line1: 'sdsdfsdf',
line2: 'hsgdbhd',
line3: 'alsksoe',
state: 'zsaasdas',
zip: '571201'
},
phone: {country_code: '+1', number: '123456789'}
}
})
};
fetch('https://sandbox.birrpay.io/subscriptions', 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/subscriptions",
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([
'billing' => [
'address' => [
'city' => 'San Fransico',
'country' => 'US',
'first_name' => 'joseph',
'last_name' => 'Doe',
'line1' => '1467',
'line2' => 'Harrison Street',
'line3' => 'Harrison Street',
'state' => 'California',
'zip' => '94122'
],
'phone' => [
'country_code' => '+1',
'number' => '123456789'
]
],
'customer_id' => 'cust_123456789',
'description' => 'Hello this is description',
'item_price_id' => 'standard-plan-USD-Monthly',
'merchant_reference_id' => 'mer_ref_123456789',
'payment_details' => [
'authentication_type' => 'no_three_ds',
'capture_method' => 'automatic',
'customer_acceptance' => [
'acceptance_type' => 'online',
'accepted_at' => '1963-05-03T04:07:52.723Z',
'online' => [
'ip_address' => '127.0.0.1',
'user_agent' => 'amet irure esse'
]
],
'payment_method' => 'card',
'payment_method_data' => [
'card' => [
'card_cvc' => '737',
'card_exp_month' => '03',
'card_exp_year' => '2030',
'card_holder_name' => 'CLBRW dffdg',
'card_number' => '4000000000000002'
]
],
'payment_method_type' => 'credit',
'payment_type' => 'setup_mandate',
'return_url' => 'https://google.com',
'setup_future_usage' => 'off_session'
],
'shipping' => [
'address' => [
'city' => 'Banglore',
'country' => 'US',
'first_name' => 'joseph',
'last_name' => 'doe',
'line1' => 'sdsdfsdf',
'line2' => 'hsgdbhd',
'line3' => 'alsksoe',
'state' => 'zsaasdas',
'zip' => '571201'
],
'phone' => [
'country_code' => '+1',
'number' => '123456789'
]
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"X-Profile-Id: <x-profile-id>",
"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/subscriptions"
payload := strings.NewReader("{\n \"billing\": {\n \"address\": {\n \"city\": \"San Fransico\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"state\": \"California\",\n \"zip\": \"94122\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n },\n \"customer_id\": \"cust_123456789\",\n \"description\": \"Hello this is description\",\n \"item_price_id\": \"standard-plan-USD-Monthly\",\n \"merchant_reference_id\": \"mer_ref_123456789\",\n \"payment_details\": {\n \"authentication_type\": \"no_three_ds\",\n \"capture_method\": \"automatic\",\n \"customer_acceptance\": {\n \"acceptance_type\": \"online\",\n \"accepted_at\": \"1963-05-03T04:07:52.723Z\",\n \"online\": {\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"amet irure esse\"\n }\n },\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_cvc\": \"737\",\n \"card_exp_month\": \"03\",\n \"card_exp_year\": \"2030\",\n \"card_holder_name\": \"CLBRW dffdg\",\n \"card_number\": \"4000000000000002\"\n }\n },\n \"payment_method_type\": \"credit\",\n \"payment_type\": \"setup_mandate\",\n \"return_url\": \"https://google.com\",\n \"setup_future_usage\": \"off_session\"\n },\n \"shipping\": {\n \"address\": {\n \"city\": \"Banglore\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"doe\",\n \"line1\": \"sdsdfsdf\",\n \"line2\": \"hsgdbhd\",\n \"line3\": \"alsksoe\",\n \"state\": \"zsaasdas\",\n \"zip\": \"571201\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("X-Profile-Id", "<x-profile-id>")
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/subscriptions")
.header("X-Profile-Id", "<x-profile-id>")
.header("api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"billing\": {\n \"address\": {\n \"city\": \"San Fransico\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"state\": \"California\",\n \"zip\": \"94122\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n },\n \"customer_id\": \"cust_123456789\",\n \"description\": \"Hello this is description\",\n \"item_price_id\": \"standard-plan-USD-Monthly\",\n \"merchant_reference_id\": \"mer_ref_123456789\",\n \"payment_details\": {\n \"authentication_type\": \"no_three_ds\",\n \"capture_method\": \"automatic\",\n \"customer_acceptance\": {\n \"acceptance_type\": \"online\",\n \"accepted_at\": \"1963-05-03T04:07:52.723Z\",\n \"online\": {\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"amet irure esse\"\n }\n },\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_cvc\": \"737\",\n \"card_exp_month\": \"03\",\n \"card_exp_year\": \"2030\",\n \"card_holder_name\": \"CLBRW dffdg\",\n \"card_number\": \"4000000000000002\"\n }\n },\n \"payment_method_type\": \"credit\",\n \"payment_type\": \"setup_mandate\",\n \"return_url\": \"https://google.com\",\n \"setup_future_usage\": \"off_session\"\n },\n \"shipping\": {\n \"address\": {\n \"city\": \"Banglore\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"doe\",\n \"line1\": \"sdsdfsdf\",\n \"line2\": \"hsgdbhd\",\n \"line3\": \"alsksoe\",\n \"state\": \"zsaasdas\",\n \"zip\": \"571201\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://sandbox.birrpay.io/subscriptions")
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["api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"billing\": {\n \"address\": {\n \"city\": \"San Fransico\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"Doe\",\n \"line1\": \"1467\",\n \"line2\": \"Harrison Street\",\n \"line3\": \"Harrison Street\",\n \"state\": \"California\",\n \"zip\": \"94122\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n },\n \"customer_id\": \"cust_123456789\",\n \"description\": \"Hello this is description\",\n \"item_price_id\": \"standard-plan-USD-Monthly\",\n \"merchant_reference_id\": \"mer_ref_123456789\",\n \"payment_details\": {\n \"authentication_type\": \"no_three_ds\",\n \"capture_method\": \"automatic\",\n \"customer_acceptance\": {\n \"acceptance_type\": \"online\",\n \"accepted_at\": \"1963-05-03T04:07:52.723Z\",\n \"online\": {\n \"ip_address\": \"127.0.0.1\",\n \"user_agent\": \"amet irure esse\"\n }\n },\n \"payment_method\": \"card\",\n \"payment_method_data\": {\n \"card\": {\n \"card_cvc\": \"737\",\n \"card_exp_month\": \"03\",\n \"card_exp_year\": \"2030\",\n \"card_holder_name\": \"CLBRW dffdg\",\n \"card_number\": \"4000000000000002\"\n }\n },\n \"payment_method_type\": \"credit\",\n \"payment_type\": \"setup_mandate\",\n \"return_url\": \"https://google.com\",\n \"setup_future_usage\": \"off_session\"\n },\n \"shipping\": {\n \"address\": {\n \"city\": \"Banglore\",\n \"country\": \"US\",\n \"first_name\": \"joseph\",\n \"last_name\": \"doe\",\n \"line1\": \"sdsdfsdf\",\n \"line2\": \"hsgdbhd\",\n \"line3\": \"alsksoe\",\n \"state\": \"zsaasdas\",\n \"zip\": \"571201\"\n },\n \"phone\": {\n \"country_code\": \"+1\",\n \"number\": \"123456789\"\n }\n }\n}"
response = http.request(request)
puts response.read_body{
"id": "<string>",
"profile_id": "<string>",
"merchant_id": "<string>",
"customer_id": "<string>",
"merchant_reference_id": "<string>",
"plan_id": "<string>",
"item_price_id": "<string>",
"client_secret": "<string>",
"coupon_code": "<string>",
"payment": {
"payment_id": "<string>",
"amount": 123,
"profile_id": "<string>",
"connector": "<string>",
"payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8",
"return_url": "<string>",
"next_action": {
"redirect_to_url": "<string>",
"type": "redirect_to_url"
},
"error_code": "<string>",
"error_message": "<string>",
"client_secret": "<string>",
"billing": {
"address": {
"city": "New York",
"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>"
},
"shipping": {
"address": {
"city": "New York",
"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>"
},
"payment_token": "token_sxJdmpUnpNsJk5VWzcjl"
},
"invoice": {
"id": "<string>",
"subscription_id": "<string>",
"merchant_id": "<string>",
"profile_id": "<string>",
"merchant_connector_id": "<string>",
"customer_id": "<string>",
"amount": 123,
"payment_intent_id": "<string>",
"payment_method_id": "pm_01926c58bc6e77c09e809964e72af8c8",
"billing_processor_invoice_id": "<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.
Headers
Profile ID for authentication
Body
Identifier for the associated item_price_id for the subscription.
A type for customer_id that can be used for customer ids
Show child attributes
Show child attributes
Identifier for the associated plan_id.
Identifier for the coupon code for the subscription.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Merchant specific Unique identifier.
Response
Subscription created and confirmed successfully
Response payload returned after successfully creating a subscription.
Includes details such as subscription ID, status, plan, merchant, and customer info.
A type for subscription_id that can be used for subscription ids
Possible states of a subscription lifecycle.
Created: Subscription was created but not yet activated.Active: Subscription is currently active.InActive: Subscription is inactive.Pending: Subscription is pending activation.Trial: Subscription is in a trial period.Paused: Subscription is paused.Unpaid: Subscription is unpaid.Onetime: Subscription is a one-time payment.Cancelled: Subscription has been cancelled.Failed: Subscription has failed.
active, created, in_active, pending, trial, paused, unpaid, onetime, cancelled, failed A type for profile_id that can be used for business profile ids
A type for merchant_id that can be used for merchant ids
A type for customer_id that can be used for customer ids
Merchant specific Unique identifier.
Identifier for the associated subscription plan.
Identifier for the associated item_price_id for the subscription.
This is a token which expires after 15 minutes, used from the client to authenticate and create sessions from the SDK
Optional coupon code applied to this subscription.
Show child attributes
Show child attributes
Show child attributes
Show child attributes