curl -X POST https://api.paybridgenp.com/v1/refunds \
-H "Authorization: Bearer sk_test_your_key" \
-H "Content-Type: application/json" \
-d '{
"paymentId": "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
"amount": 10000,
"reason": "customer_request",
"notes": "Customer requested refund"
}'const refund = await paybridgenp.refunds.create({
paymentId: "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
amount: 10000,
reason: "customer_request",
notes: "Customer requested refund",
});
console.log(refund.status); // "succeeded" | "requires_action"import requests
url = "https://api.paybridgenp.com/v1/refunds"
payload = {
"paymentId": "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
"amount": 10000,
"reason": "customer_request",
"notes": "Customer contacted support, order not delivered.",
"mobileNumber": "9801234567"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paybridgenp.com/v1/refunds",
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([
'paymentId' => 'pay_01j9x2k3m4n5p6q7r8s9t0u1v2',
'amount' => 10000,
'reason' => 'customer_request',
'notes' => 'Customer contacted support, order not delivered.',
'mobileNumber' => '9801234567'
]),
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://api.paybridgenp.com/v1/refunds"
payload := strings.NewReader("{\n \"paymentId\": \"pay_01j9x2k3m4n5p6q7r8s9t0u1v2\",\n \"amount\": 10000,\n \"reason\": \"customer_request\",\n \"notes\": \"Customer contacted support, order not delivered.\",\n \"mobileNumber\": \"9801234567\"\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://api.paybridgenp.com/v1/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paymentId\": \"pay_01j9x2k3m4n5p6q7r8s9t0u1v2\",\n \"amount\": 10000,\n \"reason\": \"customer_request\",\n \"notes\": \"Customer contacted support, order not delivered.\",\n \"mobileNumber\": \"9801234567\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paybridgenp.com/v1/refunds")
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 \"paymentId\": \"pay_01j9x2k3m4n5p6q7r8s9t0u1v2\",\n \"amount\": 10000,\n \"reason\": \"customer_request\",\n \"notes\": \"Customer contacted support, order not delivered.\",\n \"mobileNumber\": \"9801234567\"\n}"
response = http.request(request)
puts response.read_body{
"id": "ref_01j9x2k3m4n5p6q7r8s9t0u1v2",
"livemode": true,
"paymentId": "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
"projectId": "<string>",
"mode": "sandbox",
"amount": 10000,
"currency": "NPR",
"reason": "customer_request",
"status": "processing",
"providerRefundId": "<string>",
"failureReason": "<string>",
"notes": "<string>",
"mobileNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}Create a refund
Initiates a refund for a successful payment.
Provider behaviour:
- Khalti - fully automated. The refund is processed immediately via the Khalti API, and the response status will be
succeededon success orfailedif Khalti rejects it. - eSewa - does not expose a public refund API. The refund is recorded with status
requires_action. You must process it manually through the eSewa merchant portal and the record will serve as your audit trail. - Fonepay - not available through this API. Fonepay refunds are full-amount only and are issued from the PayBridgeNP dashboard instead; a request against a Fonepay payment returns
422.
Partial refunds: For Khalti and eSewa, you can issue multiple partial refunds against a single payment until the total reaches the original payment amount. The amount you request may not exceed the payment’s remaining unrefunded balance.
curl -X POST https://api.paybridgenp.com/v1/refunds \
-H "Authorization: Bearer sk_test_your_key" \
-H "Content-Type: application/json" \
-d '{
"paymentId": "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
"amount": 10000,
"reason": "customer_request",
"notes": "Customer requested refund"
}'const refund = await paybridgenp.refunds.create({
paymentId: "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
amount: 10000,
reason: "customer_request",
notes: "Customer requested refund",
});
console.log(refund.status); // "succeeded" | "requires_action"import requests
url = "https://api.paybridgenp.com/v1/refunds"
payload = {
"paymentId": "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
"amount": 10000,
"reason": "customer_request",
"notes": "Customer contacted support, order not delivered.",
"mobileNumber": "9801234567"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)<?php
$curl = curl_init();
curl_setopt_array($curl, [
CURLOPT_URL => "https://api.paybridgenp.com/v1/refunds",
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([
'paymentId' => 'pay_01j9x2k3m4n5p6q7r8s9t0u1v2',
'amount' => 10000,
'reason' => 'customer_request',
'notes' => 'Customer contacted support, order not delivered.',
'mobileNumber' => '9801234567'
]),
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://api.paybridgenp.com/v1/refunds"
payload := strings.NewReader("{\n \"paymentId\": \"pay_01j9x2k3m4n5p6q7r8s9t0u1v2\",\n \"amount\": 10000,\n \"reason\": \"customer_request\",\n \"notes\": \"Customer contacted support, order not delivered.\",\n \"mobileNumber\": \"9801234567\"\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://api.paybridgenp.com/v1/refunds")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paymentId\": \"pay_01j9x2k3m4n5p6q7r8s9t0u1v2\",\n \"amount\": 10000,\n \"reason\": \"customer_request\",\n \"notes\": \"Customer contacted support, order not delivered.\",\n \"mobileNumber\": \"9801234567\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paybridgenp.com/v1/refunds")
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 \"paymentId\": \"pay_01j9x2k3m4n5p6q7r8s9t0u1v2\",\n \"amount\": 10000,\n \"reason\": \"customer_request\",\n \"notes\": \"Customer contacted support, order not delivered.\",\n \"mobileNumber\": \"9801234567\"\n}"
response = http.request(request)
puts response.read_body{
"id": "ref_01j9x2k3m4n5p6q7r8s9t0u1v2",
"livemode": true,
"paymentId": "pay_01j9x2k3m4n5p6q7r8s9t0u1v2",
"projectId": "<string>",
"mode": "sandbox",
"amount": 10000,
"currency": "NPR",
"reason": "customer_request",
"status": "processing",
"providerRefundId": "<string>",
"failureReason": "<string>",
"notes": "<string>",
"mobileNumber": "<string>",
"createdAt": "2023-11-07T05:31:56Z",
"updatedAt": "2023-11-07T05:31:56Z"
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}Authorizations
Your PayBridgeNP API key. Obtain one from the dashboard under Settings → API Keys. Prefix: sk_test_ for testing, sk_live_ for production.
Body
ID of the payment to refund (prefix: pay_).
"pay_01j9x2k3m4n5p6q7r8s9t0u1v2"
Amount to refund in paisa. Must be ≤ the remaining refundable amount.
10000
Reason for the refund.
customer_request, duplicate, fraudulent, other "customer_request"
Internal note visible in the dashboard. Not shown to customers.
"Customer contacted support, order not delivered."
Customer mobile number. Required by some Khalti configurations.
"9801234567"
Response
Refund created.
"ref_01j9x2k3m4n5p6q7r8s9t0u1v2"
true when created with a live key, false for sandbox.
"pay_01j9x2k3m4n5p6q7r8s9t0u1v2"
sandbox, live Refunded amount in paisa.
10000
"NPR"
customer_request, duplicate, fraudulent, other succeeded - refund processed. requires_action - eSewa: must be processed manually via merchant portal. failed - provider rejected the refund.
processing, succeeded, failed, requires_action Provider's refund reference (Khalti only).
Set when status is failed or requires_action.
Was this page helpful?