Update a one-time invoice draft
curl --request PATCH \
--url https://api.paybridgenp.com/v1/invoices/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 123,
"lines": [
{}
],
"dueAt": "2023-11-07T05:31:56Z",
"customerId": "<string>",
"buyer": {},
"taxRateBps": 123,
"externalReference": "<string>",
"note": "<string>"
}
'import requests
url = "https://api.paybridgenp.com/v1/invoices/{id}"
payload = {
"version": 123,
"lines": [{}],
"dueAt": "2023-11-07T05:31:56Z",
"customerId": "<string>",
"buyer": {},
"taxRateBps": 123,
"externalReference": "<string>",
"note": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: 123,
lines: [{}],
dueAt: '2023-11-07T05:31:56Z',
customerId: '<string>',
buyer: {},
taxRateBps: 123,
externalReference: '<string>',
note: '<string>'
})
};
fetch('https://api.paybridgenp.com/v1/invoices/{id}', 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://api.paybridgenp.com/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'version' => 123,
'lines' => [
[
]
],
'dueAt' => '2023-11-07T05:31:56Z',
'customerId' => '<string>',
'buyer' => [
],
'taxRateBps' => 123,
'externalReference' => '<string>',
'note' => '<string>'
]),
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/invoices/{id}"
payload := strings.NewReader("{\n \"version\": 123,\n \"lines\": [\n {}\n ],\n \"dueAt\": \"2023-11-07T05:31:56Z\",\n \"customerId\": \"<string>\",\n \"buyer\": {},\n \"taxRateBps\": 123,\n \"externalReference\": \"<string>\",\n \"note\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.paybridgenp.com/v1/invoices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 123,\n \"lines\": [\n {}\n ],\n \"dueAt\": \"2023-11-07T05:31:56Z\",\n \"customerId\": \"<string>\",\n \"buyer\": {},\n \"taxRateBps\": 123,\n \"externalReference\": \"<string>\",\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paybridgenp.com/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 123,\n \"lines\": [\n {}\n ],\n \"dueAt\": \"2023-11-07T05:31:56Z\",\n \"customerId\": \"<string>\",\n \"buyer\": {},\n \"taxRateBps\": 123,\n \"externalReference\": \"<string>\",\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "oinv_01j9x2k3m4n5p6q7r8s9t0u1v2",
"object": "standalone_invoice",
"livemode": true,
"version": 123,
"document_status": "draft",
"collection_status": "unpaid",
"currency": "NPR",
"total_amount": 123,
"amount_paid": 123,
"amount_adjusted": 123,
"amount_remaining": 123,
"due_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"invoice_number": "TEST-PI-000001",
"overdue": true,
"lines": [
{
"id": "<string>",
"description": "<string>",
"quantity": "<string>",
"unitAmount": 123,
"lineTotal": 123
}
],
"subtotal": 123,
"tax_total": 123,
"tax_rate_bps": 123,
"amount_excess": 123,
"customer_id": "<string>",
"buyer": {
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"address": "<string>"
},
"seller": {
"name": "<string>",
"legalName": "<string>",
"email": "jsmith@example.com",
"logoUrl": "<string>",
"brandColor": "<string>"
},
"issued_at": "2023-11-07T05:31:56Z",
"external_reference": "<string>",
"note": "<string>",
"needs_attention": true,
"voided_at": "2023-11-07T05:31:56Z",
"void_reason": "<string>",
"corrected_by_invoice_id": "<string>",
"correction_of_invoice_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"detail": "<string>",
"refund": {
"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"
},
"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",
"detail": "<string>",
"refund": {
"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"
},
"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",
"detail": "<string>",
"refund": {
"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"
},
"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",
"detail": "<string>",
"refund": {
"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"
},
"suspension": {
"suspended_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
},
"pause": {
"paused_at": "2023-11-07T05:31:56Z",
"reason": "<string>"
}
}
}One-time Invoices
Update a one-time invoice draft
PATCH
/
v1
/
invoices
/
{id}
Update a one-time invoice draft
curl --request PATCH \
--url https://api.paybridgenp.com/v1/invoices/{id} \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"version": 123,
"lines": [
{}
],
"dueAt": "2023-11-07T05:31:56Z",
"customerId": "<string>",
"buyer": {},
"taxRateBps": 123,
"externalReference": "<string>",
"note": "<string>"
}
'import requests
url = "https://api.paybridgenp.com/v1/invoices/{id}"
payload = {
"version": 123,
"lines": [{}],
"dueAt": "2023-11-07T05:31:56Z",
"customerId": "<string>",
"buyer": {},
"taxRateBps": 123,
"externalReference": "<string>",
"note": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.patch(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'PATCH',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
version: 123,
lines: [{}],
dueAt: '2023-11-07T05:31:56Z',
customerId: '<string>',
buyer: {},
taxRateBps: 123,
externalReference: '<string>',
note: '<string>'
})
};
fetch('https://api.paybridgenp.com/v1/invoices/{id}', 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://api.paybridgenp.com/v1/invoices/{id}",
CURLOPT_RETURNTRANSFER => true,
CURLOPT_ENCODING => "",
CURLOPT_MAXREDIRS => 10,
CURLOPT_TIMEOUT => 30,
CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
CURLOPT_CUSTOMREQUEST => "PATCH",
CURLOPT_POSTFIELDS => json_encode([
'version' => 123,
'lines' => [
[
]
],
'dueAt' => '2023-11-07T05:31:56Z',
'customerId' => '<string>',
'buyer' => [
],
'taxRateBps' => 123,
'externalReference' => '<string>',
'note' => '<string>'
]),
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/invoices/{id}"
payload := strings.NewReader("{\n \"version\": 123,\n \"lines\": [\n {}\n ],\n \"dueAt\": \"2023-11-07T05:31:56Z\",\n \"customerId\": \"<string>\",\n \"buyer\": {},\n \"taxRateBps\": 123,\n \"externalReference\": \"<string>\",\n \"note\": \"<string>\"\n}")
req, _ := http.NewRequest("PATCH", 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.patch("https://api.paybridgenp.com/v1/invoices/{id}")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"version\": 123,\n \"lines\": [\n {}\n ],\n \"dueAt\": \"2023-11-07T05:31:56Z\",\n \"customerId\": \"<string>\",\n \"buyer\": {},\n \"taxRateBps\": 123,\n \"externalReference\": \"<string>\",\n \"note\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.paybridgenp.com/v1/invoices/{id}")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Patch.new(url)
request["Authorization"] = 'Bearer <token>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"version\": 123,\n \"lines\": [\n {}\n ],\n \"dueAt\": \"2023-11-07T05:31:56Z\",\n \"customerId\": \"<string>\",\n \"buyer\": {},\n \"taxRateBps\": 123,\n \"externalReference\": \"<string>\",\n \"note\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "oinv_01j9x2k3m4n5p6q7r8s9t0u1v2",
"object": "standalone_invoice",
"livemode": true,
"version": 123,
"document_status": "draft",
"collection_status": "unpaid",
"currency": "NPR",
"total_amount": 123,
"amount_paid": 123,
"amount_adjusted": 123,
"amount_remaining": 123,
"due_at": "2023-11-07T05:31:56Z",
"created_at": "2023-11-07T05:31:56Z",
"invoice_number": "TEST-PI-000001",
"overdue": true,
"lines": [
{
"id": "<string>",
"description": "<string>",
"quantity": "<string>",
"unitAmount": 123,
"lineTotal": 123
}
],
"subtotal": 123,
"tax_total": 123,
"tax_rate_bps": 123,
"amount_excess": 123,
"customer_id": "<string>",
"buyer": {
"name": "<string>",
"email": "jsmith@example.com",
"phone": "<string>",
"address": "<string>"
},
"seller": {
"name": "<string>",
"legalName": "<string>",
"email": "jsmith@example.com",
"logoUrl": "<string>",
"brandColor": "<string>"
},
"issued_at": "2023-11-07T05:31:56Z",
"external_reference": "<string>",
"note": "<string>",
"needs_attention": true,
"voided_at": "2023-11-07T05:31:56Z",
"void_reason": "<string>",
"corrected_by_invoice_id": "<string>",
"correction_of_invoice_id": "<string>"
}{
"error": {
"message": "<string>",
"type": "authentication_error",
"code": "<string>",
"request_id": "req_2Je91NlWKuXkdXUJOK9gaHNW",
"detail": "<string>",
"refund": {
"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"
},
"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",
"detail": "<string>",
"refund": {
"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"
},
"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",
"detail": "<string>",
"refund": {
"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"
},
"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",
"detail": "<string>",
"refund": {
"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"
},
"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.
Path Parameters
One-time invoice ID (prefix oinv_).
Body
application/json
Response
One-time invoice.
Example:
"oinv_01j9x2k3m4n5p6q7r8s9t0u1v2"
Available options:
standalone_invoice Optimistic-lock version required when editing or finalising.
Available options:
draft, issued, void Available options:
unpaid, part_paid, paid, closed_adjusted Available options:
NPR Paisa.
Allocated payment amount in paisa.
Collection reductions in paisa.
Current collectible balance in paisa.
Null on drafts. Live numbers use PI-; sandbox numbers use TEST-PI-.
Example:
"TEST-PI-000001"
Show child attributes
Show child attributes
Paisa.
Paisa.
Received above the collectible balance, in paisa.
Show child attributes
Show child attributes
Show child attributes
Show child attributes
Was this page helpful?