Legacy (v0)
Create a PayPal order
Creates a PayPal order to pay for a Fluid premium messaging subscription, using Fluid’s own PayPal account. Send the order payload in paypal; it is forwarded unchanged to PayPal’s Create Order API. Pass the returned PayPal order ID when you create the subscription. Requires a company token. Always answers 200: check success, and read message when it is false.
POST
/
api
/
company
/
subscriptions
/
create_paypal_order
Create a PayPal order
curl --request POST \
--url https://api.fluid.app/api/company/subscriptions/create_paypal_order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"paypal": {
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "19.00"
}
}
]
}
}
'import requests
url = "https://api.fluid.app/api/company/subscriptions/create_paypal_order"
payload = { "paypal": {
"intent": "CAPTURE",
"purchase_units": [{ "amount": {
"currency_code": "USD",
"value": "19.00"
} }]
} }
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({
paypal: {
intent: 'CAPTURE',
purchase_units: [{amount: {currency_code: 'USD', value: '19.00'}}]
}
})
};
fetch('https://api.fluid.app/api/company/subscriptions/create_paypal_order', 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.fluid.app/api/company/subscriptions/create_paypal_order",
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([
'paypal' => [
'intent' => 'CAPTURE',
'purchase_units' => [
[
'amount' => [
'currency_code' => 'USD',
'value' => '19.00'
]
]
]
]
]),
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.fluid.app/api/company/subscriptions/create_paypal_order"
payload := strings.NewReader("{\n \"paypal\": {\n \"intent\": \"CAPTURE\",\n \"purchase_units\": [\n {\n \"amount\": {\n \"currency_code\": \"USD\",\n \"value\": \"19.00\"\n }\n }\n ]\n }\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.fluid.app/api/company/subscriptions/create_paypal_order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paypal\": {\n \"intent\": \"CAPTURE\",\n \"purchase_units\": [\n {\n \"amount\": {\n \"currency_code\": \"USD\",\n \"value\": \"19.00\"\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/company/subscriptions/create_paypal_order")
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 \"paypal\": {\n \"intent\": \"CAPTURE\",\n \"purchase_units\": [\n {\n \"amount\": {\n \"currency_code\": \"USD\",\n \"value\": \"19.00\"\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "5O190127TN364715T",
"status": "CREATED",
"links": [
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "approve",
"method": "GET"
}
]
}
}{
"message": "<string>"
}Response
Success
Outcome of creating the PayPal order. This operation answers 200 whether or not PayPal accepted the order, so check success.
⌘I
Create a PayPal order
curl --request POST \
--url https://api.fluid.app/api/company/subscriptions/create_paypal_order \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '
{
"paypal": {
"intent": "CAPTURE",
"purchase_units": [
{
"amount": {
"currency_code": "USD",
"value": "19.00"
}
}
]
}
}
'import requests
url = "https://api.fluid.app/api/company/subscriptions/create_paypal_order"
payload = { "paypal": {
"intent": "CAPTURE",
"purchase_units": [{ "amount": {
"currency_code": "USD",
"value": "19.00"
} }]
} }
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({
paypal: {
intent: 'CAPTURE',
purchase_units: [{amount: {currency_code: 'USD', value: '19.00'}}]
}
})
};
fetch('https://api.fluid.app/api/company/subscriptions/create_paypal_order', 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.fluid.app/api/company/subscriptions/create_paypal_order",
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([
'paypal' => [
'intent' => 'CAPTURE',
'purchase_units' => [
[
'amount' => [
'currency_code' => 'USD',
'value' => '19.00'
]
]
]
]
]),
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.fluid.app/api/company/subscriptions/create_paypal_order"
payload := strings.NewReader("{\n \"paypal\": {\n \"intent\": \"CAPTURE\",\n \"purchase_units\": [\n {\n \"amount\": {\n \"currency_code\": \"USD\",\n \"value\": \"19.00\"\n }\n }\n ]\n }\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.fluid.app/api/company/subscriptions/create_paypal_order")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"paypal\": {\n \"intent\": \"CAPTURE\",\n \"purchase_units\": [\n {\n \"amount\": {\n \"currency_code\": \"USD\",\n \"value\": \"19.00\"\n }\n }\n ]\n }\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api.fluid.app/api/company/subscriptions/create_paypal_order")
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 \"paypal\": {\n \"intent\": \"CAPTURE\",\n \"purchase_units\": [\n {\n \"amount\": {\n \"currency_code\": \"USD\",\n \"value\": \"19.00\"\n }\n }\n ]\n }\n}"
response = http.request(request)
puts response.read_body{
"success": true,
"data": {
"id": "5O190127TN364715T",
"status": "CREATED",
"links": [
{
"href": "https://www.paypal.com/checkoutnow?token=5O190127TN364715T",
"rel": "approve",
"method": "GET"
}
]
}
}{
"message": "<string>"
}