Orders
Get Order Invoice
Get an order’s invoice data.
GET
/
v1
/
customer-portal
/
orders
/
{id}
/
invoice
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerOrderInvoice != nil {
// handle response
}
}import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.orders.invoice(security=polar_sdk.CustomerPortalOrdersInvoiceSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.invoice({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalOrdersInvoiceSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->orders->invoice(
security: $requestSecurity,
id: '<value>'
);
if ($response->customerOrderInvoice !== null) {
// handle response
}curl --request GET \
--url https://api.polar.sh/v1/customer-portal/orders/{id}/invoice \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/orders/{id}/invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/customer-portal/orders/{id}/invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/orders/{id}/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}The invoice must be generated first before it can be retrieved. You should call the
POST /v1/customer-portal/orders/{id}/invoice endpoint to generate the invoice.If the invoice is not generated, you will receive a 404 error.Authorizations
customer_sessionmember_session
Customer session tokens are specific tokens that are used to authenticate customers on your organization. You can create those sessions programmatically using the Create Customer Session endpoint.
Path Parameters
The order ID.
Response
Successful Response
Order's invoice data.
The URL to the invoice.
Was this page helpful?
⌘I
Go (SDK)
package main
import(
"context"
polargo "github.com/polarsource/polar-go"
"os"
"github.com/polarsource/polar-go/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := polargo.New()
res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{
CustomerSession: polargo.Pointer(os.Getenv("POLAR_CUSTOMER_SESSION")),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerOrderInvoice != nil {
// handle response
}
}import polar_sdk
from polar_sdk import Polar
with Polar() as polar:
res = polar.customer_portal.orders.invoice(security=polar_sdk.CustomerPortalOrdersInvoiceSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Handle response
print(res)import { Polar } from "@polar-sh/sdk";
const polar = new Polar();
async function run() {
const result = await polar.customerPortal.orders.invoice({
customerSession: process.env["POLAR_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Polar;
use Polar\Models\Operations;
$sdk = Polar\Polar::builder()->build();
$requestSecurity = new Operations\CustomerPortalOrdersInvoiceSecurity(
customerSession: '<YOUR_BEARER_TOKEN_HERE>',
);
$response = $sdk->customerPortal->orders->invoice(
security: $requestSecurity,
id: '<value>'
);
if ($response->customerOrderInvoice !== null) {
// handle response
}curl --request GET \
--url https://api.polar.sh/v1/customer-portal/orders/{id}/invoice \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.polar.sh/v1/customer-portal/orders/{id}/invoice', options)
.then(res => res.json())
.then(res => console.log(res))
.catch(err => console.error(err));HttpResponse<String> response = Unirest.get("https://api.polar.sh/v1/customer-portal/orders/{id}/invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.polar.sh/v1/customer-portal/orders/{id}/invoice")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Get.new(url)
request["Authorization"] = 'Bearer <token>'
response = http.request(request)
puts response.read_body{
"url": "<string>"
}{
"error": "<string>",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>",
"input": "<unknown>",
"ctx": {}
}
]
}
