Orders
Get Order Invoice
Get an order’s invoice data.
GET
/
v1
/
customer-portal
/
orders
/
{id}
/
invoice
Go (SDK)
package main
import(
"context"
macropaygo "github.com/web3group/macropay-go-main"
"os"
"github.com/web3group/macropay-go-main/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New()
res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{
CustomerSession: os.Getenv("MACROPAY_CUSTOMER_SESSION"),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerOrderInvoice != nil {
// handle response
}
}import macropay_sdk
from macropay_sdk import Macropay
with Macropay() as macropay:
res = macropay.customer_portal.orders.invoice(security=macropay_sdk.CustomerPortalOrdersInvoiceSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Handle response
print(res)import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay();
async function run() {
const result = await macropay.customerPortal.orders.invoice({
customerSession: process.env["MACROPAY_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
use Macropay\Models\Operations;
$sdk = Macropay\Macropay::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.macropay.ai/v1/customer-portal/orders/{id}/invoice \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/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.macropay.ai/v1/customer-portal/orders/{id}/invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/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": "ResourceNotFound",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}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.
⌘I
Go (SDK)
package main
import(
"context"
macropaygo "github.com/web3group/macropay-go-main"
"os"
"github.com/web3group/macropay-go-main/models/operations"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New()
res, err := s.CustomerPortal.Orders.Invoice(ctx, operations.CustomerPortalOrdersInvoiceSecurity{
CustomerSession: os.Getenv("MACROPAY_CUSTOMER_SESSION"),
}, "<value>")
if err != nil {
log.Fatal(err)
}
if res.CustomerOrderInvoice != nil {
// handle response
}
}import macropay_sdk
from macropay_sdk import Macropay
with Macropay() as macropay:
res = macropay.customer_portal.orders.invoice(security=macropay_sdk.CustomerPortalOrdersInvoiceSecurity(
customer_session="<YOUR_BEARER_TOKEN_HERE>",
), id="<value>")
# Handle response
print(res)import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay();
async function run() {
const result = await macropay.customerPortal.orders.invoice({
customerSession: process.env["MACROPAY_CUSTOMER_SESSION"] ?? "",
}, {
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
use Macropay\Models\Operations;
$sdk = Macropay\Macropay::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.macropay.ai/v1/customer-portal/orders/{id}/invoice \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/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.macropay.ai/v1/customer-portal/orders/{id}/invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/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": "ResourceNotFound",
"detail": "<string>"
}{
"detail": [
{
"loc": [
"<string>"
],
"msg": "<string>",
"type": "<string>"
}
]
}