Initiate Transaction
Credit Card
Initiate a credit card collection. Returns a hosted checkoutUrl — redirect the customer there to enter card details.
curl --location 'https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in' \
--header 'x-api-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--header 'user-agent: YOUR_USER_AGENT' \
--header 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT' \
--header 'x-source-channel: web' \
--data '{
"amount": 500,
"payment_mode": "CREDIT_CARD",
"order_id": "TXN_98767",
"customer_info": {
"name": "John Doe",
"email": "johndoe@example.com",
"phone_country_code": "+91",
"phone": "9999988888"
}
}'
const headers = { 'x-api-key': 'YOUR_SECRET_KEY', 'Content-Type': 'application/json', 'user-agent': 'YOUR_USER_AGENT', 'x-browser-fingerprint': 'YOUR_BROWSER_FINGERPRINT', 'x-source-channel': 'web' };
const body = { amount: 500, payment_mode: 'CREDIT_CARD', order_id: 'TXN_98767', customer_info: { name: 'John Doe', email: 'johndoe@example.com', phone_country_code: '+91', phone: '9999988888' } };
const response = await fetch('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in', { method: 'POST', headers, body: JSON.stringify(body) });
console.log(await response.json());
import requests
response = requests.post(
"https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in",
headers={
"x-api-key": "YOUR_SECRET_KEY",
"Content-Type": "application/json",
"user-agent": "YOUR_USER_AGENT",
"x-browser-fingerprint": "YOUR_BROWSER_FINGERPRINT",
"x-source-channel": "web",
},
json={
"amount": 500,
"payment_mode": "CREDIT_CARD",
"order_id": "TXN_98767",
"customer_info": {
"name": "John Doe",
"email": "johndoe@example.com",
"phone_country_code": "+91",
"phone": "9999988888",
},
},
)
print(response.json())
var body = "{\"amount\":500,\"payment_mode\":\"CREDIT_CARD\",\"order_id\":\"TXN_98767\",\"customer_info\":{\"name\":\"John Doe\",\"email\":\"johndoe@example.com\",\"phone_country_code\":\"+91\",\"phone\":\"9999988888\"}}";
var request = java.net.http.HttpRequest.newBuilder(java.net.URI.create("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")).headers("x-api-key", "YOUR_SECRET_KEY", "Content-Type", "application/json", "user-agent", "YOUR_USER_AGENT", "x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT", "x-source-channel", "web").POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
var response = java.net.http.HttpClient.newHttpClient().send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import ("bytes"; "fmt"; "io"; "net/http")
func main() {
body := []byte(`{"amount":500,"payment_mode":"CREDIT_CARD","order_id":"TXN_98767","customer_info":{"name":"John Doe","email":"johndoe@example.com","phone_country_code":"+91","phone":"9999988888"}}`)
request, err := http.NewRequest(http.MethodPost, "https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in", bytes.NewBuffer(body))
if err != nil { panic(err) }
request.Header.Set("x-api-key", "YOUR_SECRET_KEY")
request.Header.Set("Content-Type", "application/json")
request.Header.Set("user-agent", "YOUR_USER_AGENT")
request.Header.Set("x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT")
request.Header.Set("x-source-channel", "web")
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
data, _ := io.ReadAll(response.Body)
fmt.Println(string(data))
}
<?php
$curl = curl_init('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_SECRET_KEY', 'Content-Type: application/json', 'user-agent: YOUR_USER_AGENT', 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT', 'x-source-channel: web'],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 500, 'payment_mode' => 'CREDIT_CARD', 'order_id' => 'TXN_98767',
'customer_info' => ['name' => 'John Doe', 'email' => 'johndoe@example.com', 'phone_country_code' => '+91', 'phone' => '9999988888'],
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
require "json"
require "net/http"
uri = URI("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")
request = Net::HTTP::Post.new(uri, {"x-api-key" => "YOUR_SECRET_KEY", "Content-Type" => "application/json", "user-agent" => "YOUR_USER_AGENT", "x-browser-fingerprint" => "YOUR_BROWSER_FINGERPRINT", "x-source-channel" => "web"})
request.body = {amount: 500, payment_mode: "CREDIT_CARD", order_id: "TXN_98767", customer_info: {name: "John Doe", email: "johndoe@example.com", phone_country_code: "+91", phone: "9999988888"}}.to_json
puts Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request).body }
{
"status": "SUCCESS",
"status_code": 200,
"message": "Transaction initiated successfully",
"detail": null,
"data": {
"orderId": "TXN_98767",
"statusDesc": "Transaction initiated successfully",
"status": "INITIATED",
"checkoutUrl": "https://example.com/checkout",
"ref_id": "XXXXXXXXXXXXXXXXXXX"
}
}
Credit card collections return a hosted
checkoutUrl. Redirect your customer to that URL to complete paymentreturn a hosted checkoutUrl. Redirect your customer to that URL to complete payment.
curl --location 'https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in' \
--header 'x-api-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--header 'user-agent: YOUR_USER_AGENT' \
--header 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT' \
--header 'x-source-channel: web' \
--data '{
"amount": 500,
"payment_mode": "CREDIT_CARD",
"order_id": "TXN_98767",
"customer_info": {
"name": "John Doe",
"email": "johndoe@example.com",
"phone_country_code": "+91",
"phone": "9999988888"
}
}'
const headers = { 'x-api-key': 'YOUR_SECRET_KEY', 'Content-Type': 'application/json', 'user-agent': 'YOUR_USER_AGENT', 'x-browser-fingerprint': 'YOUR_BROWSER_FINGERPRINT', 'x-source-channel': 'web' };
const body = { amount: 500, payment_mode: 'CREDIT_CARD', order_id: 'TXN_98767', customer_info: { name: 'John Doe', email: 'johndoe@example.com', phone_country_code: '+91', phone: '9999988888' } };
const response = await fetch('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in', { method: 'POST', headers, body: JSON.stringify(body) });
console.log(await response.json());
import requests
response = requests.post(
"https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in",
headers={
"x-api-key": "YOUR_SECRET_KEY",
"Content-Type": "application/json",
"user-agent": "YOUR_USER_AGENT",
"x-browser-fingerprint": "YOUR_BROWSER_FINGERPRINT",
"x-source-channel": "web",
},
json={
"amount": 500,
"payment_mode": "CREDIT_CARD",
"order_id": "TXN_98767",
"customer_info": {
"name": "John Doe",
"email": "johndoe@example.com",
"phone_country_code": "+91",
"phone": "9999988888",
},
},
)
print(response.json())
var body = "{\"amount\":500,\"payment_mode\":\"CREDIT_CARD\",\"order_id\":\"TXN_98767\",\"customer_info\":{\"name\":\"John Doe\",\"email\":\"johndoe@example.com\",\"phone_country_code\":\"+91\",\"phone\":\"9999988888\"}}";
var request = java.net.http.HttpRequest.newBuilder(java.net.URI.create("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")).headers("x-api-key", "YOUR_SECRET_KEY", "Content-Type", "application/json", "user-agent", "YOUR_USER_AGENT", "x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT", "x-source-channel", "web").POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
var response = java.net.http.HttpClient.newHttpClient().send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import ("bytes"; "fmt"; "io"; "net/http")
func main() {
body := []byte(`{"amount":500,"payment_mode":"CREDIT_CARD","order_id":"TXN_98767","customer_info":{"name":"John Doe","email":"johndoe@example.com","phone_country_code":"+91","phone":"9999988888"}}`)
request, err := http.NewRequest(http.MethodPost, "https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in", bytes.NewBuffer(body))
if err != nil { panic(err) }
request.Header.Set("x-api-key", "YOUR_SECRET_KEY")
request.Header.Set("Content-Type", "application/json")
request.Header.Set("user-agent", "YOUR_USER_AGENT")
request.Header.Set("x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT")
request.Header.Set("x-source-channel", "web")
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
data, _ := io.ReadAll(response.Body)
fmt.Println(string(data))
}
<?php
$curl = curl_init('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_SECRET_KEY', 'Content-Type: application/json', 'user-agent: YOUR_USER_AGENT', 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT', 'x-source-channel: web'],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 500, 'payment_mode' => 'CREDIT_CARD', 'order_id' => 'TXN_98767',
'customer_info' => ['name' => 'John Doe', 'email' => 'johndoe@example.com', 'phone_country_code' => '+91', 'phone' => '9999988888'],
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
require "json"
require "net/http"
uri = URI("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")
request = Net::HTTP::Post.new(uri, {"x-api-key" => "YOUR_SECRET_KEY", "Content-Type" => "application/json", "user-agent" => "YOUR_USER_AGENT", "x-browser-fingerprint" => "YOUR_BROWSER_FINGERPRINT", "x-source-channel" => "web"})
request.body = {amount: 500, payment_mode: "CREDIT_CARD", order_id: "TXN_98767", customer_info: {name: "John Doe", email: "johndoe@example.com", phone_country_code: "+91", phone: "9999988888"}}.to_json
puts Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request).body }
{
"status": "SUCCESS",
"status_code": 200,
"message": "Transaction initiated successfully",
"detail": null,
"data": {
"orderId": "TXN_98767",
"statusDesc": "Transaction initiated successfully",
"status": "INITIATED",
"checkoutUrl": "https://example.com/checkout",
"ref_id": "XXXXXXXXXXXXXXXXXXX"
}
}
⌘I
curl --location 'https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in' \
--header 'x-api-key: YOUR_SECRET_KEY' \
--header 'Content-Type: application/json' \
--header 'user-agent: YOUR_USER_AGENT' \
--header 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT' \
--header 'x-source-channel: web' \
--data '{
"amount": 500,
"payment_mode": "CREDIT_CARD",
"order_id": "TXN_98767",
"customer_info": {
"name": "John Doe",
"email": "johndoe@example.com",
"phone_country_code": "+91",
"phone": "9999988888"
}
}'
const headers = { 'x-api-key': 'YOUR_SECRET_KEY', 'Content-Type': 'application/json', 'user-agent': 'YOUR_USER_AGENT', 'x-browser-fingerprint': 'YOUR_BROWSER_FINGERPRINT', 'x-source-channel': 'web' };
const body = { amount: 500, payment_mode: 'CREDIT_CARD', order_id: 'TXN_98767', customer_info: { name: 'John Doe', email: 'johndoe@example.com', phone_country_code: '+91', phone: '9999988888' } };
const response = await fetch('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in', { method: 'POST', headers, body: JSON.stringify(body) });
console.log(await response.json());
import requests
response = requests.post(
"https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in",
headers={
"x-api-key": "YOUR_SECRET_KEY",
"Content-Type": "application/json",
"user-agent": "YOUR_USER_AGENT",
"x-browser-fingerprint": "YOUR_BROWSER_FINGERPRINT",
"x-source-channel": "web",
},
json={
"amount": 500,
"payment_mode": "CREDIT_CARD",
"order_id": "TXN_98767",
"customer_info": {
"name": "John Doe",
"email": "johndoe@example.com",
"phone_country_code": "+91",
"phone": "9999988888",
},
},
)
print(response.json())
var body = "{\"amount\":500,\"payment_mode\":\"CREDIT_CARD\",\"order_id\":\"TXN_98767\",\"customer_info\":{\"name\":\"John Doe\",\"email\":\"johndoe@example.com\",\"phone_country_code\":\"+91\",\"phone\":\"9999988888\"}}";
var request = java.net.http.HttpRequest.newBuilder(java.net.URI.create("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")).headers("x-api-key", "YOUR_SECRET_KEY", "Content-Type", "application/json", "user-agent", "YOUR_USER_AGENT", "x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT", "x-source-channel", "web").POST(java.net.http.HttpRequest.BodyPublishers.ofString(body)).build();
var response = java.net.http.HttpClient.newHttpClient().send(request, java.net.http.HttpResponse.BodyHandlers.ofString());
System.out.println(response.body());
package main
import ("bytes"; "fmt"; "io"; "net/http")
func main() {
body := []byte(`{"amount":500,"payment_mode":"CREDIT_CARD","order_id":"TXN_98767","customer_info":{"name":"John Doe","email":"johndoe@example.com","phone_country_code":"+91","phone":"9999988888"}}`)
request, err := http.NewRequest(http.MethodPost, "https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in", bytes.NewBuffer(body))
if err != nil { panic(err) }
request.Header.Set("x-api-key", "YOUR_SECRET_KEY")
request.Header.Set("Content-Type", "application/json")
request.Header.Set("user-agent", "YOUR_USER_AGENT")
request.Header.Set("x-browser-fingerprint", "YOUR_BROWSER_FINGERPRINT")
request.Header.Set("x-source-channel", "web")
response, err := http.DefaultClient.Do(request)
if err != nil { panic(err) }
defer response.Body.Close()
data, _ := io.ReadAll(response.Body)
fmt.Println(string(data))
}
<?php
$curl = curl_init('https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in');
curl_setopt_array($curl, [
CURLOPT_POST => true,
CURLOPT_HTTPHEADER => ['x-api-key: YOUR_SECRET_KEY', 'Content-Type: application/json', 'user-agent: YOUR_USER_AGENT', 'x-browser-fingerprint: YOUR_BROWSER_FINGERPRINT', 'x-source-channel: web'],
CURLOPT_POSTFIELDS => json_encode([
'amount' => 500, 'payment_mode' => 'CREDIT_CARD', 'order_id' => 'TXN_98767',
'customer_info' => ['name' => 'John Doe', 'email' => 'johndoe@example.com', 'phone_country_code' => '+91', 'phone' => '9999988888'],
]),
CURLOPT_RETURNTRANSFER => true,
]);
$response = curl_exec($curl);
curl_close($curl);
echo $response;
require "json"
require "net/http"
uri = URI("https://api.bluswap.co/api/v1/merchants/transactions/initiate_pay_in")
request = Net::HTTP::Post.new(uri, {"x-api-key" => "YOUR_SECRET_KEY", "Content-Type" => "application/json", "user-agent" => "YOUR_USER_AGENT", "x-browser-fingerprint" => "YOUR_BROWSER_FINGERPRINT", "x-source-channel" => "web"})
request.body = {amount: 500, payment_mode: "CREDIT_CARD", order_id: "TXN_98767", customer_info: {name: "John Doe", email: "johndoe@example.com", phone_country_code: "+91", phone: "9999988888"}}.to_json
puts Net::HTTP.start(uri.hostname, uri.port, use_ssl: true) { |http| http.request(request).body }
{
"status": "SUCCESS",
"status_code": 200,
"message": "Transaction initiated successfully",
"detail": null,
"data": {
"orderId": "TXN_98767",
"statusDesc": "Transaction initiated successfully",
"status": "INITIATED",
"checkoutUrl": "https://example.com/checkout",
"ref_id": "XXXXXXXXXXXXXXXXXXX"
}
}
