curl --request POST \
--url https://api-sandbox.beinfi.com/payment-links \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"key": "<string>",
"name": "<string>",
"description": "<string>",
"currency": "<string>",
"basePrice": "<string>",
"meters": [
{
"name": "<string>",
"displayName": "<string>",
"valueProperty": "<string>"
}
],
"prices": [
{
"meter": "<string>",
"unitAmount": "<string>",
"tiers": {},
"currency": "<string>"
}
]
},
"successUrl": "<string>",
"cancelUrl": "<string>"
}
'import requests
url = "https://api-sandbox.beinfi.com/payment-links"
payload = {
"product": {
"key": "<string>",
"name": "<string>",
"description": "<string>",
"currency": "<string>",
"basePrice": "<string>",
"meters": [
{
"name": "<string>",
"displayName": "<string>",
"valueProperty": "<string>"
}
],
"prices": [
{
"meter": "<string>",
"unitAmount": "<string>",
"tiers": {},
"currency": "<string>"
}
]
},
"successUrl": "<string>",
"cancelUrl": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
product: {
key: '<string>',
name: '<string>',
description: '<string>',
currency: '<string>',
basePrice: '<string>',
meters: [{name: '<string>', displayName: '<string>', valueProperty: '<string>'}],
prices: [{meter: '<string>', unitAmount: '<string>', tiers: {}, currency: '<string>'}]
},
successUrl: '<string>',
cancelUrl: '<string>'
})
};
fetch('https://api-sandbox.beinfi.com/payment-links', 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-sandbox.beinfi.com/payment-links",
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([
'product' => [
'key' => '<string>',
'name' => '<string>',
'description' => '<string>',
'currency' => '<string>',
'basePrice' => '<string>',
'meters' => [
[
'name' => '<string>',
'displayName' => '<string>',
'valueProperty' => '<string>'
]
],
'prices' => [
[
'meter' => '<string>',
'unitAmount' => '<string>',
'tiers' => [
],
'currency' => '<string>'
]
]
],
'successUrl' => '<string>',
'cancelUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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-sandbox.beinfi.com/payment-links"
payload := strings.NewReader("{\n \"product\": {\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"<string>\",\n \"basePrice\": \"<string>\",\n \"meters\": [\n {\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"valueProperty\": \"<string>\"\n }\n ],\n \"prices\": [\n {\n \"meter\": \"<string>\",\n \"unitAmount\": \"<string>\",\n \"tiers\": {},\n \"currency\": \"<string>\"\n }\n ]\n },\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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-sandbox.beinfi.com/payment-links")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"<string>\",\n \"basePrice\": \"<string>\",\n \"meters\": [\n {\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"valueProperty\": \"<string>\"\n }\n ],\n \"prices\": [\n {\n \"meter\": \"<string>\",\n \"unitAmount\": \"<string>\",\n \"tiers\": {},\n \"currency\": \"<string>\"\n }\n ]\n },\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/payment-links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"product\": {\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"<string>\",\n \"basePrice\": \"<string>\",\n \"meters\": [\n {\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"valueProperty\": \"<string>\"\n }\n ],\n \"prices\": [\n {\n \"meter\": \"<string>\",\n \"unitAmount\": \"<string>\",\n \"tiers\": {},\n \"currency\": \"<string>\"\n }\n ]\n },\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"url": "<string>",
"productVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"active": true,
"revokedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"successUrl": "<string>",
"cancelUrl": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}Create a link with a product
From nothing to a payable URL in one call. The product is identified by its key: a new key creates it, a known one reuses it, and pricing that differs from the current one publishes a new version. Links already shared keep selling the price they advertised.
Every call creates a new link, so you can have one URL per campaign. The response carries the url to send the payer; you do not need to pass your account slug.
curl --request POST \
--url https://api-sandbox.beinfi.com/payment-links \
--header 'Content-Type: application/json' \
--data '
{
"product": {
"key": "<string>",
"name": "<string>",
"description": "<string>",
"currency": "<string>",
"basePrice": "<string>",
"meters": [
{
"name": "<string>",
"displayName": "<string>",
"valueProperty": "<string>"
}
],
"prices": [
{
"meter": "<string>",
"unitAmount": "<string>",
"tiers": {},
"currency": "<string>"
}
]
},
"successUrl": "<string>",
"cancelUrl": "<string>"
}
'import requests
url = "https://api-sandbox.beinfi.com/payment-links"
payload = {
"product": {
"key": "<string>",
"name": "<string>",
"description": "<string>",
"currency": "<string>",
"basePrice": "<string>",
"meters": [
{
"name": "<string>",
"displayName": "<string>",
"valueProperty": "<string>"
}
],
"prices": [
{
"meter": "<string>",
"unitAmount": "<string>",
"tiers": {},
"currency": "<string>"
}
]
},
"successUrl": "<string>",
"cancelUrl": "<string>"
}
headers = {"Content-Type": "application/json"}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'Content-Type': 'application/json'},
body: JSON.stringify({
product: {
key: '<string>',
name: '<string>',
description: '<string>',
currency: '<string>',
basePrice: '<string>',
meters: [{name: '<string>', displayName: '<string>', valueProperty: '<string>'}],
prices: [{meter: '<string>', unitAmount: '<string>', tiers: {}, currency: '<string>'}]
},
successUrl: '<string>',
cancelUrl: '<string>'
})
};
fetch('https://api-sandbox.beinfi.com/payment-links', 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-sandbox.beinfi.com/payment-links",
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([
'product' => [
'key' => '<string>',
'name' => '<string>',
'description' => '<string>',
'currency' => '<string>',
'basePrice' => '<string>',
'meters' => [
[
'name' => '<string>',
'displayName' => '<string>',
'valueProperty' => '<string>'
]
],
'prices' => [
[
'meter' => '<string>',
'unitAmount' => '<string>',
'tiers' => [
],
'currency' => '<string>'
]
]
],
'successUrl' => '<string>',
'cancelUrl' => '<string>'
]),
CURLOPT_HTTPHEADER => [
"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-sandbox.beinfi.com/payment-links"
payload := strings.NewReader("{\n \"product\": {\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"<string>\",\n \"basePrice\": \"<string>\",\n \"meters\": [\n {\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"valueProperty\": \"<string>\"\n }\n ],\n \"prices\": [\n {\n \"meter\": \"<string>\",\n \"unitAmount\": \"<string>\",\n \"tiers\": {},\n \"currency\": \"<string>\"\n }\n ]\n },\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
req, _ := http.NewRequest("POST", url, payload)
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-sandbox.beinfi.com/payment-links")
.header("Content-Type", "application/json")
.body("{\n \"product\": {\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"<string>\",\n \"basePrice\": \"<string>\",\n \"meters\": [\n {\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"valueProperty\": \"<string>\"\n }\n ],\n \"prices\": [\n {\n \"meter\": \"<string>\",\n \"unitAmount\": \"<string>\",\n \"tiers\": {},\n \"currency\": \"<string>\"\n }\n ]\n },\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://api-sandbox.beinfi.com/payment-links")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["Content-Type"] = 'application/json'
request.body = "{\n \"product\": {\n \"key\": \"<string>\",\n \"name\": \"<string>\",\n \"description\": \"<string>\",\n \"currency\": \"<string>\",\n \"basePrice\": \"<string>\",\n \"meters\": [\n {\n \"name\": \"<string>\",\n \"displayName\": \"<string>\",\n \"valueProperty\": \"<string>\"\n }\n ],\n \"prices\": [\n {\n \"meter\": \"<string>\",\n \"unitAmount\": \"<string>\",\n \"tiers\": {},\n \"currency\": \"<string>\"\n }\n ]\n },\n \"successUrl\": \"<string>\",\n \"cancelUrl\": \"<string>\"\n}"
response = http.request(request)
puts response.read_body{
"id": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"productId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"token": "<string>",
"url": "<string>",
"productVersionId": "3c90c3cc-0d44-4b50-8888-8dd25736052a",
"active": true,
"revokedAt": "2023-11-07T05:31:56Z",
"createdAt": "2023-11-07T05:31:56Z",
"successUrl": "<string>",
"cancelUrl": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>"
}{
"message": "<string>",
"error_code": "internal_error",
"tracer_id": "<string>",
"errors": [
{
"field": "<string>",
"value": "<string>",
"constraint": "<string>",
"description": "<string>"
}
]
}Body
The product, defined inline and identified by its key.
Show child attributes
Show child attributes
Where the payer goes after paying, with ?status=success&invoice=… appended. Absolute http(s) URL.
2048Offered to the payer as "back to the store" while the checkout is open. Absolute http(s) URL.
2048Response
Link created.
A reusable, revocable payment link bound to a product. Anyone holding it can open the checkout; it is meant to be copied and shared.
The link's public token, part of the url.
The address to send the payer. Use this value instead of building the URL yourself.
The product version this link sells, fixed at creation. Publishing a new version does not reprice a link already issued. When null, the link sells the latest published version at payment time.
false once revoked.
When the link was revoked.
Where the payer goes after paying, with ?status=success&invoice=… appended.
Offered to the payer as "back to the store" while the checkout is open; also the ?status=error destination when the charge expires in the embedded checkout.