Orders
Get Order Invoice
Get an order’s invoice data.
Scopes: orders:read
GET
/
v1
/
orders
/
{id}
/
invoice
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Orders.Invoice(ctx, "<value>")
if err != nil {
log.Fatal(err)
}
if res.OrderInvoice != nil {
// handle response
}
}from macropay_sdk import Macropay
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
res = macropay.orders.invoice(id="<value>")
# Handle response
print(res)import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await macropay.orders.invoice({
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->orders->invoice(
id: '<value>'
);
if ($response->orderInvoice !== null) {
// handle response
}curl --request GET \
--url https://api.macropay.ai/v1/orders/{id}/invoice \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/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/orders/{id}/invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/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>"
}
]
}The invoice must be generated first before it can be retrieved. You should call the
POST /v1/orders/{id}/invoice endpoint to generate the invoice.If the invoice is not generated, you will receive a 404 error.⌘I
Go (SDK)
package main
import(
"context"
"os"
macropaygo "github.com/web3group/macropay-go-main"
"log"
)
func main() {
ctx := context.Background()
s := macropaygo.New(
macropaygo.WithSecurity(os.Getenv("MACROPAY_ACCESS_TOKEN")),
)
res, err := s.Orders.Invoice(ctx, "<value>")
if err != nil {
log.Fatal(err)
}
if res.OrderInvoice != nil {
// handle response
}
}from macropay_sdk import Macropay
with Macropay(
access_token="<YOUR_BEARER_TOKEN_HERE>",
) as macropay:
res = macropay.orders.invoice(id="<value>")
# Handle response
print(res)import { Macropay } from "@macropayments/sdk";
const macropay = new Macropay({
accessToken: process.env["MACROPAY_ACCESS_TOKEN"] ?? "",
});
async function run() {
const result = await macropay.orders.invoice({
id: "<value>",
});
console.log(result);
}
run();declare(strict_types=1);
require 'vendor/autoload.php';
use Macropay;
$sdk = Macropay\Macropay::builder()
->setSecurity(
'<YOUR_BEARER_TOKEN_HERE>'
)
->build();
$response = $sdk->orders->invoice(
id: '<value>'
);
if ($response->orderInvoice !== null) {
// handle response
}curl --request GET \
--url https://api.macropay.ai/v1/orders/{id}/invoice \
--header 'Authorization: Bearer <token>'const options = {method: 'GET', headers: {Authorization: 'Bearer <token>'}};
fetch('https://api.macropay.ai/v1/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/orders/{id}/invoice")
.header("Authorization", "Bearer <token>")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.macropay.ai/v1/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>"
}
]
}