Create a charge
curl --request POST \
--url https://api.plane.com/v1/charges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payments": [
"<string>"
],
"source": "<string>",
"date": "<string>",
"reference": "<string>",
"metadata": {}
}
'import requests
url = "https://api.plane.com/v1/charges"
payload = {
"payments": ["<string>"],
"source": "<string>",
"date": "<string>",
"reference": "<string>",
"metadata": {}
}
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({
payments: ['<string>'],
source: '<string>',
date: '<string>',
reference: '<string>',
metadata: {}
})
};
fetch('https://api.plane.com/v1/charges', 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.plane.com/v1/charges",
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([
'payments' => [
'<string>'
],
'source' => '<string>',
'date' => '<string>',
'reference' => '<string>',
'metadata' => [
]
]),
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.plane.com/v1/charges"
payload := strings.NewReader("{\n \"payments\": [\n \"<string>\"\n ],\n \"source\": \"<string>\",\n \"date\": \"<string>\",\n \"reference\": \"<string>\",\n \"metadata\": {}\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.plane.com/v1/charges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payments\": [\n \"<string>\"\n ],\n \"source\": \"<string>\",\n \"date\": \"<string>\",\n \"reference\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.plane.com/v1/charges")
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 \"payments\": [\n \"<string>\"\n ],\n \"source\": \"<string>\",\n \"date\": \"<string>\",\n \"reference\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "ch_oUEpLsdApEb3EGzEeYTBRvGv",
"status": "pending"
}
Charges
Create a charge
POST
/
v1
/
charges
Create a charge
curl --request POST \
--url https://api.plane.com/v1/charges \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"payments": [
"<string>"
],
"source": "<string>",
"date": "<string>",
"reference": "<string>",
"metadata": {}
}
'import requests
url = "https://api.plane.com/v1/charges"
payload = {
"payments": ["<string>"],
"source": "<string>",
"date": "<string>",
"reference": "<string>",
"metadata": {}
}
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({
payments: ['<string>'],
source: '<string>',
date: '<string>',
reference: '<string>',
metadata: {}
})
};
fetch('https://api.plane.com/v1/charges', 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.plane.com/v1/charges",
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([
'payments' => [
'<string>'
],
'source' => '<string>',
'date' => '<string>',
'reference' => '<string>',
'metadata' => [
]
]),
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.plane.com/v1/charges"
payload := strings.NewReader("{\n \"payments\": [\n \"<string>\"\n ],\n \"source\": \"<string>\",\n \"date\": \"<string>\",\n \"reference\": \"<string>\",\n \"metadata\": {}\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.plane.com/v1/charges")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"payments\": [\n \"<string>\"\n ],\n \"source\": \"<string>\",\n \"date\": \"<string>\",\n \"reference\": \"<string>\",\n \"metadata\": {}\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.plane.com/v1/charges")
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 \"payments\": [\n \"<string>\"\n ],\n \"source\": \"<string>\",\n \"date\": \"<string>\",\n \"reference\": \"<string>\",\n \"metadata\": {}\n}"
response = http.request(request)
puts response.read_body{
"id": "ch_oUEpLsdApEb3EGzEeYTBRvGv",
"status": "pending"
}
When you create a Payment on Plane, it will not process unless it’s funded. Charges are used to fund payments.
You can create a Charge by passing in a list of payments that you’re looking to fund.
Parameters
string[]
required
A list of payment IDs that you’re attempting to charge.
string
ID of the Source you will use to fund this Charge. When omitted, your default Source will be used.
string
The date when you want Plane to collect funds from your bank account. When left blank, Plane will
use the closest available date.
string
A reference for this charge visible on your bank statement. When ommitted, Plane will generate a
new 8-character reference for each charge.
object
Set of key-value pairs that you can attach to an object. This can be useful for storing additional
information about the object in a structured format.
Returns
Returns the created charge ID and current status. Retrieve the full Charge object with Get a charge. Returns an error code if create parameters are invalid.{
"id": "ch_oUEpLsdApEb3EGzEeYTBRvGv",
"status": "pending"
}
Was this page helpful?
⌘I