curl --request POST \
--url https://demo-api-harmony.compago.com/api/one-time-payment \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": 100,
"currency": "MXN",
"externalId": "tracking-id-from-your-system",
"description": "Lorem ipsum dolor sit amet",
"homepageUrl": "https://app.compago.com/",
"redirectUrl": "https://app.compago.com/",
"ttlMinutes": 1440,
"allowedTerms": [
12
]
}
'import requests
url = "https://demo-api-harmony.compago.com/api/one-time-payment"
payload = {
"amount": 100,
"currency": "MXN",
"externalId": "tracking-id-from-your-system",
"description": "Lorem ipsum dolor sit amet",
"homepageUrl": "https://app.compago.com/",
"redirectUrl": "https://app.compago.com/",
"ttlMinutes": 1440,
"allowedTerms": [12]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 100,
currency: 'MXN',
externalId: 'tracking-id-from-your-system',
description: 'Lorem ipsum dolor sit amet',
homepageUrl: 'https://app.compago.com/',
redirectUrl: 'https://app.compago.com/',
ttlMinutes: 1440,
allowedTerms: [12]
})
};
fetch('https://demo-api-harmony.compago.com/api/one-time-payment', 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://demo-api-harmony.compago.com/api/one-time-payment",
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' => 100,
'currency' => 'MXN',
'externalId' => 'tracking-id-from-your-system',
'description' => 'Lorem ipsum dolor sit amet',
'homepageUrl' => 'https://app.compago.com/',
'redirectUrl' => 'https://app.compago.com/',
'ttlMinutes' => 1440,
'allowedTerms' => [
12
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://demo-api-harmony.compago.com/api/one-time-payment"
payload := strings.NewReader("{\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"externalId\": \"tracking-id-from-your-system\",\n \"description\": \"Lorem ipsum dolor sit amet\",\n \"homepageUrl\": \"https://app.compago.com/\",\n \"redirectUrl\": \"https://app.compago.com/\",\n \"ttlMinutes\": 1440,\n \"allowedTerms\": [\n 12\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://demo-api-harmony.compago.com/api/one-time-payment")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"externalId\": \"tracking-id-from-your-system\",\n \"description\": \"Lorem ipsum dolor sit amet\",\n \"homepageUrl\": \"https://app.compago.com/\",\n \"redirectUrl\": \"https://app.compago.com/\",\n \"ttlMinutes\": 1440,\n \"allowedTerms\": [\n 12\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api-harmony.compago.com/api/one-time-payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"externalId\": \"tracking-id-from-your-system\",\n \"description\": \"Lorem ipsum dolor sit amet\",\n \"homepageUrl\": \"https://app.compago.com/\",\n \"redirectUrl\": \"https://app.compago.com/\",\n \"ttlMinutes\": 1440,\n \"allowedTerms\": [\n 12\n ]\n}"
response = http.request(request)
puts response.read_body{
"redirectUrl": "<string>"
}{
"message": "<string>",
"code": "ALLOWED_TERMS_UNAVAILABLE",
"unavailableTerms": [
18
],
"availableTerms": [
1,
3,
6,
12
]
}Create
curl --request POST \
--url https://demo-api-harmony.compago.com/api/one-time-payment \
--header 'Content-Type: application/json' \
--header 'x-api-key: <api-key>' \
--data '
{
"amount": 100,
"currency": "MXN",
"externalId": "tracking-id-from-your-system",
"description": "Lorem ipsum dolor sit amet",
"homepageUrl": "https://app.compago.com/",
"redirectUrl": "https://app.compago.com/",
"ttlMinutes": 1440,
"allowedTerms": [
12
]
}
'import requests
url = "https://demo-api-harmony.compago.com/api/one-time-payment"
payload = {
"amount": 100,
"currency": "MXN",
"externalId": "tracking-id-from-your-system",
"description": "Lorem ipsum dolor sit amet",
"homepageUrl": "https://app.compago.com/",
"redirectUrl": "https://app.compago.com/",
"ttlMinutes": 1440,
"allowedTerms": [12]
}
headers = {
"x-api-key": "<api-key>",
"Content-Type": "application/json"
}
response = requests.post(url, json=payload, headers=headers)
print(response.text)const options = {
method: 'POST',
headers: {'x-api-key': '<api-key>', 'Content-Type': 'application/json'},
body: JSON.stringify({
amount: 100,
currency: 'MXN',
externalId: 'tracking-id-from-your-system',
description: 'Lorem ipsum dolor sit amet',
homepageUrl: 'https://app.compago.com/',
redirectUrl: 'https://app.compago.com/',
ttlMinutes: 1440,
allowedTerms: [12]
})
};
fetch('https://demo-api-harmony.compago.com/api/one-time-payment', 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://demo-api-harmony.compago.com/api/one-time-payment",
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' => 100,
'currency' => 'MXN',
'externalId' => 'tracking-id-from-your-system',
'description' => 'Lorem ipsum dolor sit amet',
'homepageUrl' => 'https://app.compago.com/',
'redirectUrl' => 'https://app.compago.com/',
'ttlMinutes' => 1440,
'allowedTerms' => [
12
]
]),
CURLOPT_HTTPHEADER => [
"Content-Type: application/json",
"x-api-key: <api-key>"
],
]);
$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://demo-api-harmony.compago.com/api/one-time-payment"
payload := strings.NewReader("{\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"externalId\": \"tracking-id-from-your-system\",\n \"description\": \"Lorem ipsum dolor sit amet\",\n \"homepageUrl\": \"https://app.compago.com/\",\n \"redirectUrl\": \"https://app.compago.com/\",\n \"ttlMinutes\": 1440,\n \"allowedTerms\": [\n 12\n ]\n}")
req, _ := http.NewRequest("POST", url, payload)
req.Header.Add("x-api-key", "<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://demo-api-harmony.compago.com/api/one-time-payment")
.header("x-api-key", "<api-key>")
.header("Content-Type", "application/json")
.body("{\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"externalId\": \"tracking-id-from-your-system\",\n \"description\": \"Lorem ipsum dolor sit amet\",\n \"homepageUrl\": \"https://app.compago.com/\",\n \"redirectUrl\": \"https://app.compago.com/\",\n \"ttlMinutes\": 1440,\n \"allowedTerms\": [\n 12\n ]\n}")
.asString();require 'uri'
require 'net/http'
url = URI("https://demo-api-harmony.compago.com/api/one-time-payment")
http = Net::HTTP.new(url.host, url.port)
http.use_ssl = true
request = Net::HTTP::Post.new(url)
request["x-api-key"] = '<api-key>'
request["Content-Type"] = 'application/json'
request.body = "{\n \"amount\": 100,\n \"currency\": \"MXN\",\n \"externalId\": \"tracking-id-from-your-system\",\n \"description\": \"Lorem ipsum dolor sit amet\",\n \"homepageUrl\": \"https://app.compago.com/\",\n \"redirectUrl\": \"https://app.compago.com/\",\n \"ttlMinutes\": 1440,\n \"allowedTerms\": [\n 12\n ]\n}"
response = http.request(request)
puts response.read_body{
"redirectUrl": "<string>"
}{
"message": "<string>",
"code": "ALLOWED_TERMS_UNAVAILABLE",
"unavailableTerms": [
18
],
"availableTerms": [
1,
3,
6,
12
]
}Authorizations
Body
Request body for creating a one-time payment link. You can redirect the user to the resulting URL to complete the payment, the payment will be processed by the Compago platform, and then the user will be redirected back to the homepage URL provided.
The amount to be charged for the one-time payment. Must be a positive number.
100
MXN, USD "MXN"
Optional external ID to track the payment in your system. Must be unique for each payment.
"tracking-id-from-your-system"
A description of the payment. This will be displayed to the user during the payment process.
"Lorem ipsum dolor sit amet"
The homepage URL of your application to link the user back to your application in case they cancel the payment or want to go back. This should be a valid URL that your application can handle.
"https://app.compago.com/"
The URL of your application to redirect the user back to after the payment is completed. This should be a valid URL that your application can handle.
"https://app.compago.com/"
Optional. Send it when you already know the customer and the checkout asks only for the card. Omit it and the checkout asks the payer for their own name, email and phone alongside the card. Either way the details end up on the payment once it is paid.
Show child attributes
Show child attributes
Optional time-to-live in minutes for the payment link. Minimum 10 minutes, maximum 2,880 minutes (48 hours). Defaults to 48 hours if not specified.
10 <= x <= 28801440
Optional. The installment plans the checkout offers, as numbers of monthly installments: 1 is a single payment and any larger number is that many months without interest (MSI). Send one term, for example [12], and the customer pays with that plan without being able to choose another. Send several, for example [3, 6], and the customer chooses among them. Omit it, or send null, to offer every plan active on your account. Every term must be active on your account when you create the payment, otherwise the request fails with ALLOWED_TERMS_UNAVAILABLE. Duplicates are removed and the list is stored sorted. The checkout never offers a plan outside this list, and it drops any listed plan that stops being available before the customer pays.
1 - 48 elements1 <= x <= 48[12]
Response
Link successfully created