cURL
curl --request POST \
--url https://api.uselotus.io/api/credits/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"amount": 0,
"currency_code": "<string>",
"description": "<string>",
"effective_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"amount_paid": 5000000000,
"amount_paid_currency_code": "<string>"
}
'import requests
url = "https://api.uselotus.io/api/credits/"
payload = {
"customer_id": "<string>",
"amount": 0,
"currency_code": "<string>",
"description": "<string>",
"effective_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"amount_paid": 5000000000,
"amount_paid_currency_code": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
amount: 0,
currency_code: '<string>',
description: '<string>',
effective_at: '2023-11-07T05:31:56Z',
expires_at: '2023-11-07T05:31:56Z',
amount_paid: 5000000000,
amount_paid_currency_code: '<string>'
})
};
fetch('https://api.uselotus.io/api/credits/', 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.uselotus.io/api/credits/",
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([
'customer_id' => '<string>',
'amount' => 0,
'currency_code' => '<string>',
'description' => '<string>',
'effective_at' => '2023-11-07T05:31:56Z',
'expires_at' => '2023-11-07T05:31:56Z',
'amount_paid' => 5000000000,
'amount_paid_currency_code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.uselotus.io/api/credits/"
payload := strings.NewReader("{\n \"customer_id\": \"<string>\",\n \"amount\": 0,\n \"currency_code\": \"<string>\",\n \"description\": \"<string>\",\n \"effective_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"amount_paid\": 5000000000,\n \"amount_paid_currency_code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.uselotus.io/api/credits/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"<string>\",\n \"amount\": 0,\n \"currency_code\": \"<string>\",\n \"description\": \"<string>\",\n \"effective_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"amount_paid\": 5000000000,\n \"amount_paid_currency_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselotus.io/api/credits/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"<string>\",\n \"amount\": 0,\n \"currency_code\": \"<string>\",\n \"description\": \"<string>\",\n \"effective_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"amount_paid\": 5000000000,\n \"amount_paid_currency_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"credit_id": "<string>",
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"amount": 5000000000,
"amount_remaining": 5000000000,
"currency": {
"code": "<string>",
"name": "<string>",
"symbol": "<string>"
},
"description": "<string>",
"effective_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"status": "active",
"amount_paid": 0,
"amount_paid_currency": {
"code": "<string>",
"name": "<string>",
"symbol": "<string>"
},
"drawdowns": [
{
"credit_id": "<string>",
"amount": -5000000000,
"applied_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}
]
}Credits
Create a credit
Create a credit
POST
/
api
/
credits
/
cURL
curl --request POST \
--url https://api.uselotus.io/api/credits/ \
--header 'Authorization: <api-key>' \
--header 'Content-Type: application/json' \
--data '
{
"customer_id": "<string>",
"amount": 0,
"currency_code": "<string>",
"description": "<string>",
"effective_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"amount_paid": 5000000000,
"amount_paid_currency_code": "<string>"
}
'import requests
url = "https://api.uselotus.io/api/credits/"
payload = {
"customer_id": "<string>",
"amount": 0,
"currency_code": "<string>",
"description": "<string>",
"effective_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"amount_paid": 5000000000,
"amount_paid_currency_code": "<string>"
}
headers = {
"Authorization": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {Authorization: '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
customer_id: '<string>',
amount: 0,
currency_code: '<string>',
description: '<string>',
effective_at: '2023-11-07T05:31:56Z',
expires_at: '2023-11-07T05:31:56Z',
amount_paid: 5000000000,
amount_paid_currency_code: '<string>'
})
};
fetch('https://api.uselotus.io/api/credits/', 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.uselotus.io/api/credits/",
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([
'customer_id' => '<string>',
'amount' => 0,
'currency_code' => '<string>',
'description' => '<string>',
'effective_at' => '2023-11-07T05:31:56Z',
'expires_at' => '2023-11-07T05:31:56Z',
'amount_paid' => 5000000000,
'amount_paid_currency_code' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"Authorization: <api-key>",
"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.uselotus.io/api/credits/"
payload := strings.NewReader("{\n \"customer_id\": \"<string>\",\n \"amount\": 0,\n \"currency_code\": \"<string>\",\n \"description\": \"<string>\",\n \"effective_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"amount_paid\": 5000000000,\n \"amount_paid_currency_code\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("Authorization", "<api-key>")
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.uselotus.io/api/credits/")
.header("Authorization", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"customer_id\": \"<string>\",\n \"amount\": 0,\n \"currency_code\": \"<string>\",\n \"description\": \"<string>\",\n \"effective_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"amount_paid\": 5000000000,\n \"amount_paid_currency_code\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.uselotus.io/api/credits/")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Authorization"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"customer_id\": \"<string>\",\n \"amount\": 0,\n \"currency_code\": \"<string>\",\n \"description\": \"<string>\",\n \"effective_at\": \"2023-11-07T05:31:56Z\",\n \"expires_at\": \"2023-11-07T05:31:56Z\",\n \"amount_paid\": 5000000000,\n \"amount_paid_currency_code\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"credit_id": "<string>",
"customer": {
"customer_name": "<string>",
"email": "jsmith@example.com",
"customer_id": "<string>"
},
"amount": 5000000000,
"amount_remaining": 5000000000,
"currency": {
"code": "<string>",
"name": "<string>",
"symbol": "<string>"
},
"description": "<string>",
"effective_at": "2023-11-07T05:31:56Z",
"expires_at": "2023-11-07T05:31:56Z",
"status": "active",
"amount_paid": 0,
"amount_paid_currency": {
"code": "<string>",
"name": "<string>",
"symbol": "<string>"
},
"drawdowns": [
{
"credit_id": "<string>",
"amount": -5000000000,
"applied_at": "2023-11-07T05:31:56Z",
"description": "<string>"
}
]
}Creates a credit.
lotus.create_credit(
customer_id='cust_0569173ee6654369',
amount=120.00,
currency_code='USD',
)
lotus.create_credit(
customer_id='cust_0569173ee6654369',
amount=1000.00,
currency_code='USD',
description="Prepurchased credit",
expires_at="2024-01-01T00:00:00Z",
amount_paid=500.00,
amount_paid_currency_code='USD',
)
await lotus.createCredit({
customer_id: "cust_0569173ee6654369",
amount: 120.0,
currency_code: "USD",
});
await lotus.createCredit({
customer_id: "cust_0569173ee6654369",
amount: 1000.0,
currency_code: "USD",
description: "Prepurchased credit",
expires_at: "2024-01-01T00:00:00Z",
amount_paid: 500.0,
amount_paid_currency_code: "USD",
});
Authorizations
knoxTokenAuthOrganizationApiKeyAuth
Token-based authentication with required prefix "Token"
Body
application/jsonapplication/x-www-form-urlencodedmultipart/form-data
The id provided when creating the customer, we suggest matching with your internal customer id in your backend
Minimum string length:
1Required range:
-10000000000 < x < 10000000000Minimum string length:
1Required range:
0 <= x < 10000000000Minimum string length:
1Response
201 - application/json
Show child attributes
Show child attributes
Required range:
0 <= x < 10000000000Required range:
0 <= x < 10000000000Show child attributes
Show child attributes
active- Activeinactive- Inactive
Available options:
active, inactive Required range:
-10000000000 < x < 10000000000Show child attributes
Show child attributes
Show child attributes
Show child attributes