curl --request POST \
--url https://{brand_domain}/api/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "500.00",
"currency": "BDT",
"callback_url": "https://my-store.com/webhooks/ownpay",
"redirect_url": "https://my-store.com/checkout/success",
"cancel_url": "https://my-store.com/checkout/cancel",
"customer_email": "[email protected]",
"customer_name": "John Doe",
"customer_phone": "+8801700000000",
"reference": "INV-10029",
"gateway": "bkash-merchant",
"metadata": {
"store_id": "dhaka-branch",
"item_categories": [
"electronics",
"peripherals"
]
}
}
'import requests
url = "https://{brand_domain}/api/v1/payments"
payload = {
"amount": "500.00",
"currency": "BDT",
"callback_url": "https://my-store.com/webhooks/ownpay",
"redirect_url": "https://my-store.com/checkout/success",
"cancel_url": "https://my-store.com/checkout/cancel",
"customer_email": "[email protected]",
"customer_name": "John Doe",
"customer_phone": "+8801700000000",
"reference": "INV-10029",
"gateway": "bkash-merchant",
"metadata": {
"store_id": "dhaka-branch",
"item_categories": ["electronics", "peripherals"]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '500.00',
currency: 'BDT',
callback_url: 'https://my-store.com/webhooks/ownpay',
redirect_url: 'https://my-store.com/checkout/success',
cancel_url: 'https://my-store.com/checkout/cancel',
customer_email: '[email protected]',
customer_name: 'John Doe',
customer_phone: '+8801700000000',
reference: 'INV-10029',
gateway: 'bkash-merchant',
metadata: {store_id: 'dhaka-branch', item_categories: ['electronics', 'peripherals']}
})
};
fetch('https://{brand_domain}/api/v1/payments', 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://{brand_domain}/api/v1/payments",
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([
'amount' => '500.00',
'currency' => 'BDT',
'callback_url' => 'https://my-store.com/webhooks/ownpay',
'redirect_url' => 'https://my-store.com/checkout/success',
'cancel_url' => 'https://my-store.com/checkout/cancel',
'customer_email' => '[email protected]',
'customer_name' => 'John Doe',
'customer_phone' => '+8801700000000',
'reference' => 'INV-10029',
'gateway' => 'bkash-merchant',
'metadata' => [
'store_id' => 'dhaka-branch',
'item_categories' => [
'electronics',
'peripherals'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{brand_domain}/api/v1/payments"
payload := strings.NewReader("{\n \"amount\": \"500.00\",\n \"currency\": \"BDT\",\n \"callback_url\": \"https://my-store.com/webhooks/ownpay\",\n \"redirect_url\": \"https://my-store.com/checkout/success\",\n \"cancel_url\": \"https://my-store.com/checkout/cancel\",\n \"customer_email\": \"[email protected]\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"+8801700000000\",\n \"reference\": \"INV-10029\",\n \"gateway\": \"bkash-merchant\",\n \"metadata\": {\n \"store_id\": \"dhaka-branch\",\n \"item_categories\": [\n \"electronics\",\n \"peripherals\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{brand_domain}/api/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"500.00\",\n \"currency\": \"BDT\",\n \"callback_url\": \"https://my-store.com/webhooks/ownpay\",\n \"redirect_url\": \"https://my-store.com/checkout/success\",\n \"cancel_url\": \"https://my-store.com/checkout/cancel\",\n \"customer_email\": \"[email protected]\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"+8801700000000\",\n \"reference\": \"INV-10029\",\n \"gateway\": \"bkash-merchant\",\n \"metadata\": {\n \"store_id\": \"dhaka-branch\",\n \"item_categories\": [\n \"electronics\",\n \"peripherals\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{brand_domain}/api/v1/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"500.00\",\n \"currency\": \"BDT\",\n \"callback_url\": \"https://my-store.com/webhooks/ownpay\",\n \"redirect_url\": \"https://my-store.com/checkout/success\",\n \"cancel_url\": \"https://my-store.com/checkout/cancel\",\n \"customer_email\": \"[email protected]\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"+8801700000000\",\n \"reference\": \"INV-10029\",\n \"gateway\": \"bkash-merchant\",\n \"metadata\": {\n \"store_id\": \"dhaka-branch\",\n \"item_categories\": [\n \"electronics\",\n \"peripherals\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"payment_id": "a810b445-564a-4e20-80a5-f1261d7b328a",
"token": "tok_4821a8f902bd3f46",
"checkout_url": "https://ownpay.org/checkout/tok_4821a8f902bd3f46",
"status": "created"
}
}{
"success": false,
"error": "amount must be a positive number",
"errors": [
{
"code": "INVALID_AMOUNT",
"message": "amount must be a positive number",
"field": "amount"
}
],
"request_id": "8f5a2e9b0c7d4e5f"
}{
"success": false,
"error": "Payment not found",
"errors": [
{
"code": "PAYMENT_NOT_FOUND",
"message": "Payment not found",
"field": null
}
],
"request_id": "8f5a2e9b0c7d4e5f"
}Initiate Payment Intent
Initiates a new payment session by creating a payment intent. Returns a secure, white-labeled checkout URL where customers can choose from the brand’s active payment methods (such as Mobile Financial Services (MFS) e.g., bKash, Nagad, Rocket). Validates callback URLs against transport safety regulations, truncates customer PII properties to fit database constraints, and resolves/creates customer profile bindings.
curl --request POST \
--url https://{brand_domain}/api/v1/payments \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": "500.00",
"currency": "BDT",
"callback_url": "https://my-store.com/webhooks/ownpay",
"redirect_url": "https://my-store.com/checkout/success",
"cancel_url": "https://my-store.com/checkout/cancel",
"customer_email": "[email protected]",
"customer_name": "John Doe",
"customer_phone": "+8801700000000",
"reference": "INV-10029",
"gateway": "bkash-merchant",
"metadata": {
"store_id": "dhaka-branch",
"item_categories": [
"electronics",
"peripherals"
]
}
}
'import requests
url = "https://{brand_domain}/api/v1/payments"
payload = {
"amount": "500.00",
"currency": "BDT",
"callback_url": "https://my-store.com/webhooks/ownpay",
"redirect_url": "https://my-store.com/checkout/success",
"cancel_url": "https://my-store.com/checkout/cancel",
"customer_email": "[email protected]",
"customer_name": "John Doe",
"customer_phone": "+8801700000000",
"reference": "INV-10029",
"gateway": "bkash-merchant",
"metadata": {
"store_id": "dhaka-branch",
"item_categories": ["electronics", "peripherals"]
}
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: '500.00',
currency: 'BDT',
callback_url: 'https://my-store.com/webhooks/ownpay',
redirect_url: 'https://my-store.com/checkout/success',
cancel_url: 'https://my-store.com/checkout/cancel',
customer_email: '[email protected]',
customer_name: 'John Doe',
customer_phone: '+8801700000000',
reference: 'INV-10029',
gateway: 'bkash-merchant',
metadata: {store_id: 'dhaka-branch', item_categories: ['electronics', 'peripherals']}
})
};
fetch('https://{brand_domain}/api/v1/payments', 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://{brand_domain}/api/v1/payments",
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([
'amount' => '500.00',
'currency' => 'BDT',
'callback_url' => 'https://my-store.com/webhooks/ownpay',
'redirect_url' => 'https://my-store.com/checkout/success',
'cancel_url' => 'https://my-store.com/checkout/cancel',
'customer_email' => '[email protected]',
'customer_name' => 'John Doe',
'customer_phone' => '+8801700000000',
'reference' => 'INV-10029',
'gateway' => 'bkash-merchant',
'metadata' => [
'store_id' => 'dhaka-branch',
'item_categories' => [
'electronics',
'peripherals'
]
]
]),
CURLOPT_HTTPHEADER => [
"Authorization: Bearer <token>",
"Content-Type: application/json"
],
]);
$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://{brand_domain}/api/v1/payments"
payload := strings.NewReader("{\n \"amount\": \"500.00\",\n \"currency\": \"BDT\",\n \"callback_url\": \"https://my-store.com/webhooks/ownpay\",\n \"redirect_url\": \"https://my-store.com/checkout/success\",\n \"cancel_url\": \"https://my-store.com/checkout/cancel\",\n \"customer_email\": \"[email protected]\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"+8801700000000\",\n \"reference\": \"INV-10029\",\n \"gateway\": \"bkash-merchant\",\n \"metadata\": {\n \"store_id\": \"dhaka-branch\",\n \"item_categories\": [\n \"electronics\",\n \"peripherals\"\n ]\n }\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "Bearer <token>")
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://{brand_domain}/api/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": \"500.00\",\n \"currency\": \"BDT\",\n \"callback_url\": \"https://my-store.com/webhooks/ownpay\",\n \"redirect_url\": \"https://my-store.com/checkout/success\",\n \"cancel_url\": \"https://my-store.com/checkout/cancel\",\n \"customer_email\": \"[email protected]\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"+8801700000000\",\n \"reference\": \"INV-10029\",\n \"gateway\": \"bkash-merchant\",\n \"metadata\": {\n \"store_id\": \"dhaka-branch\",\n \"item_categories\": [\n \"electronics\",\n \"peripherals\"\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://{brand_domain}/api/v1/payments")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": \"500.00\",\n \"currency\": \"BDT\",\n \"callback_url\": \"https://my-store.com/webhooks/ownpay\",\n \"redirect_url\": \"https://my-store.com/checkout/success\",\n \"cancel_url\": \"https://my-store.com/checkout/cancel\",\n \"customer_email\": \"[email protected]\",\n \"customer_name\": \"John Doe\",\n \"customer_phone\": \"+8801700000000\",\n \"reference\": \"INV-10029\",\n \"gateway\": \"bkash-merchant\",\n \"metadata\": {\n \"store_id\": \"dhaka-branch\",\n \"item_categories\": [\n \"electronics\",\n \"peripherals\"\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"payment_id": "a810b445-564a-4e20-80a5-f1261d7b328a",
"token": "tok_4821a8f902bd3f46",
"checkout_url": "https://ownpay.org/checkout/tok_4821a8f902bd3f46",
"status": "created"
}
}{
"success": false,
"error": "amount must be a positive number",
"errors": [
{
"code": "INVALID_AMOUNT",
"message": "amount must be a positive number",
"field": "amount"
}
],
"request_id": "8f5a2e9b0c7d4e5f"
}{
"success": false,
"error": "Payment not found",
"errors": [
{
"code": "PAYMENT_NOT_FOUND",
"message": "Payment not found",
"field": null
}
],
"request_id": "8f5a2e9b0c7d4e5f"
}Authorizations
Provide the Bearer API Key generated for your brand.
Body
Positive numeric string representing the transaction volume (2 decimal places).
"500.00"
3-letter ISO currency code. Must be registered and supported by the platform (e.g. BDT, USD).
"BDT"
Webhook payload URL where transaction completion callbacks are POSTed. Must use HTTP or HTTPS.
"https://my-store.com/webhooks/ownpay"
Redirection target URL where the user is returned after a successful checkout session.
"https://my-store.com/checkout/success"
Redirection target URL where the user is returned if they cancel the payment session.
"https://my-store.com/checkout/cancel"
Customer email address. Used for identity verification and mapping.
Customer full name (max 150 characters).
"John Doe"
Customer phone number (max 30 characters).
"+8801700000000"
Internal order reference or invoice identifier.
"INV-10029"
Request routing through a specific payment gateway slug (optional).
"bkash-merchant"
Key-value map for merchant custom details.
{ "store_id": "dhaka-branch", "item_categories": ["electronics", "peripherals"] }
Related topics
Retrieve Payment DetailsDeveloper Quickstart - Build Your First Payment IntegrationOwnPay API Overview - REST API for Multi-Brand PaymentsNode.js SDK - TypeScript-First Payment IntegrationDispatch Test WebhookWas this page helpful?