Create order
curl --request POST \
--url https://api.lojou.app/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 748.6,
"product_pid": "QUyMp",
"customer": {
"name": "Carla Jeambi",
"email": "[email protected]",
"mobile_number": "+258876683588",
"payment_number": "<string>"
},
"plan_id": "<string>",
"from_order": "<string>",
"affiliate_id": 123,
"return_url": "<string>",
"cancel_url": "<string>",
"coupon_code": "<string>"
}
'import requests
url = "https://api.lojou.app/v1/orders"
payload = {
"amount": 748.6,
"product_pid": "QUyMp",
"customer": {
"name": "Carla Jeambi",
"email": "[email protected]",
"mobile_number": "+258876683588",
"payment_number": "<string>"
},
"plan_id": "<string>",
"from_order": "<string>",
"affiliate_id": 123,
"return_url": "<string>",
"cancel_url": "<string>",
"coupon_code": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 748.6,
product_pid: 'QUyMp',
customer: {
name: 'Carla Jeambi',
email: '[email protected]',
mobile_number: '+258876683588',
payment_number: '<string>'
},
plan_id: '<string>',
from_order: '<string>',
affiliate_id: 123,
return_url: '<string>',
cancel_url: '<string>',
coupon_code: '<string>'
})
};
fetch('https://api.lojou.app/v1/orders', 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.lojou.app/v1/orders",
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([
'amount' => 748.6,
'product_pid' => 'QUyMp',
'customer' => [
'name' => 'Carla Jeambi',
'email' => '[email protected]',
'mobile_number' => '+258876683588',
'payment_number' => '<string>'
],
'plan_id' => '<string>',
'from_order' => '<string>',
'affiliate_id' => 123,
'return_url' => '<string>',
'cancel_url' => '<string>',
'coupon_code' => '<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.lojou.app/v1/orders"
payload := strings.NewReader("{\n \"amount\": 748.6,\n \"product_pid\": \"QUyMp\",\n \"customer\": {\n \"name\": \"Carla Jeambi\",\n \"email\": \"[email protected]\",\n \"mobile_number\": \"+258876683588\",\n \"payment_number\": \"<string>\"\n },\n \"plan_id\": \"<string>\",\n \"from_order\": \"<string>\",\n \"affiliate_id\": 123,\n \"return_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"coupon_code\": \"<string>\"\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.lojou.app/v1/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 748.6,\n \"product_pid\": \"QUyMp\",\n \"customer\": {\n \"name\": \"Carla Jeambi\",\n \"email\": \"[email protected]\",\n \"mobile_number\": \"+258876683588\",\n \"payment_number\": \"<string>\"\n },\n \"plan_id\": \"<string>\",\n \"from_order\": \"<string>\",\n \"affiliate_id\": 123,\n \"return_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"coupon_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/orders")
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 \"amount\": 748.6,\n \"product_pid\": \"QUyMp\",\n \"customer\": {\n \"name\": \"Carla Jeambi\",\n \"email\": \"[email protected]\",\n \"mobile_number\": \"+258876683588\",\n \"payment_number\": \"<string>\"\n },\n \"plan_id\": \"<string>\",\n \"from_order\": \"<string>\",\n \"affiliate_id\": 123,\n \"return_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"coupon_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"success": true,
"checkout_url": "https://pay.lojou.app/token/954_aB3xY9k2m",
"message": "Checkout initialized successfully.",
"order_number": "95428522",
"pay_token": "954_aB3xY9k2m"
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Product not found."
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Orders
Create order
Creates a checkout session and returns a checkout_url to send your
customer to. Currently required fields: amount, product_pid,
customer. Pass from_order to reuse a cancelled/pending order
instead of creating a new one.
POST
/
v1
/
orders
Create order
curl --request POST \
--url https://api.lojou.app/v1/orders \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"amount": 748.6,
"product_pid": "QUyMp",
"customer": {
"name": "Carla Jeambi",
"email": "[email protected]",
"mobile_number": "+258876683588",
"payment_number": "<string>"
},
"plan_id": "<string>",
"from_order": "<string>",
"affiliate_id": 123,
"return_url": "<string>",
"cancel_url": "<string>",
"coupon_code": "<string>"
}
'import requests
url = "https://api.lojou.app/v1/orders"
payload = {
"amount": 748.6,
"product_pid": "QUyMp",
"customer": {
"name": "Carla Jeambi",
"email": "[email protected]",
"mobile_number": "+258876683588",
"payment_number": "<string>"
},
"plan_id": "<string>",
"from_order": "<string>",
"affiliate_id": 123,
"return_url": "<string>",
"cancel_url": "<string>",
"coupon_code": "<string>"
}
headers = {
"Authorization": "Bearer <token>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: 'Bearer <token>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 748.6,
product_pid: 'QUyMp',
customer: {
name: 'Carla Jeambi',
email: '[email protected]',
mobile_number: '+258876683588',
payment_number: '<string>'
},
plan_id: '<string>',
from_order: '<string>',
affiliate_id: 123,
return_url: '<string>',
cancel_url: '<string>',
coupon_code: '<string>'
})
};
fetch('https://api.lojou.app/v1/orders', 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.lojou.app/v1/orders",
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([
'amount' => 748.6,
'product_pid' => 'QUyMp',
'customer' => [
'name' => 'Carla Jeambi',
'email' => '[email protected]',
'mobile_number' => '+258876683588',
'payment_number' => '<string>'
],
'plan_id' => '<string>',
'from_order' => '<string>',
'affiliate_id' => 123,
'return_url' => '<string>',
'cancel_url' => '<string>',
'coupon_code' => '<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.lojou.app/v1/orders"
payload := strings.NewReader("{\n \"amount\": 748.6,\n \"product_pid\": \"QUyMp\",\n \"customer\": {\n \"name\": \"Carla Jeambi\",\n \"email\": \"[email protected]\",\n \"mobile_number\": \"+258876683588\",\n \"payment_number\": \"<string>\"\n },\n \"plan_id\": \"<string>\",\n \"from_order\": \"<string>\",\n \"affiliate_id\": 123,\n \"return_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"coupon_code\": \"<string>\"\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.lojou.app/v1/orders")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 748.6,\n \"product_pid\": \"QUyMp\",\n \"customer\": {\n \"name\": \"Carla Jeambi\",\n \"email\": \"[email protected]\",\n \"mobile_number\": \"+258876683588\",\n \"payment_number\": \"<string>\"\n },\n \"plan_id\": \"<string>\",\n \"from_order\": \"<string>\",\n \"affiliate_id\": 123,\n \"return_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"coupon_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.lojou.app/v1/orders")
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 \"amount\": 748.6,\n \"product_pid\": \"QUyMp\",\n \"customer\": {\n \"name\": \"Carla Jeambi\",\n \"email\": \"[email protected]\",\n \"mobile_number\": \"+258876683588\",\n \"payment_number\": \"<string>\"\n },\n \"plan_id\": \"<string>\",\n \"from_order\": \"<string>\",\n \"affiliate_id\": 123,\n \"return_url\": \"<string>\",\n \"cancel_url\": \"<string>\",\n \"coupon_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"status": "success",
"success": true,
"checkout_url": "https://pay.lojou.app/token/954_aB3xY9k2m",
"message": "Checkout initialized successfully.",
"order_number": "95428522",
"pay_token": "954_aB3xY9k2m"
}{
"status": "error",
"message": "Unauthorized user."
}{
"status": "error",
"message": "Permission denied for this endpoint.",
"error_code": "insufficient_scope",
"required_scopes": [
"orders.read"
],
"missing_scopes": [
"orders.read"
],
"granted_scopes": [
"products.read",
"products.write"
]
}{
"status": "error",
"message": "Product not found."
}{
"status": "error",
"message": "Validation failed.",
"errors": {
"amount": [
"The amount field is required."
]
}
}Autorizações
Send an API key or an OAuth access token in the Authorization header
as a Bearer token. See Authentication for details.
Corpo
application/json
Intervalo necessário:
x >= 10Exemplo:
748.6
Exemplo:
"QUyMp"
Show child attributes
Show child attributes
Reference to a previous order, to reuse it instead of creating a new one.
