Skip to main content
POST
/
v1
/
payments
Create payment
curl --request POST \
  --url https://api.hyperline.co/v1/payments \
  --header 'Authorization: Bearer <token>' \
  --header 'Content-Type: application/json' \
  --data '
{
  "type": "one_time",
  "customer_id": "cus_Typ0px2W0aiEtl",
  "charging_method": "immediately",
  "items": [
    {
      "id": "itm_3kXODDF42QXtnL",
      "name": "Product name",
      "amount": 123
    }
  ],
  "products": [
    {
      "id": "itm_3kXODDF42QXtnL",
      "name": "Product name",
      "amount": 123
    }
  ],
  "purchase_order": "<string>",
  "custom_note": "<string>",
  "payment_method_id": "pm_1ryTrMj4TTAT1N"
}
'
import requests

url = "https://api.hyperline.co/v1/payments"

payload = {
"type": "one_time",
"customer_id": "cus_Typ0px2W0aiEtl",
"charging_method": "immediately",
"items": [
{
"id": "itm_3kXODDF42QXtnL",
"name": "Product name",
"amount": 123
}
],
"products": [
{
"id": "itm_3kXODDF42QXtnL",
"name": "Product name",
"amount": 123
}
],
"purchase_order": "<string>",
"custom_note": "<string>",
"payment_method_id": "pm_1ryTrMj4TTAT1N"
}
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({
type: 'one_time',
customer_id: 'cus_Typ0px2W0aiEtl',
charging_method: 'immediately',
items: [{id: 'itm_3kXODDF42QXtnL', name: 'Product name', amount: 123}],
products: [{id: 'itm_3kXODDF42QXtnL', name: 'Product name', amount: 123}],
purchase_order: '<string>',
custom_note: '<string>',
payment_method_id: 'pm_1ryTrMj4TTAT1N'
})
};

fetch('https://api.hyperline.co/v1/payments', 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.hyperline.co/v1/payments",
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([
'type' => 'one_time',
'customer_id' => 'cus_Typ0px2W0aiEtl',
'charging_method' => 'immediately',
'items' => [
[
'id' => 'itm_3kXODDF42QXtnL',
'name' => 'Product name',
'amount' => 123
]
],
'products' => [
[
'id' => 'itm_3kXODDF42QXtnL',
'name' => 'Product name',
'amount' => 123
]
],
'purchase_order' => '<string>',
'custom_note' => '<string>',
'payment_method_id' => 'pm_1ryTrMj4TTAT1N'
]),
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.hyperline.co/v1/payments"

payload := strings.NewReader("{\n \"type\": \"one_time\",\n \"customer_id\": \"cus_Typ0px2W0aiEtl\",\n \"charging_method\": \"immediately\",\n \"items\": [\n {\n \"id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Product name\",\n \"amount\": 123\n }\n ],\n \"products\": [\n {\n \"id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Product name\",\n \"amount\": 123\n }\n ],\n \"purchase_order\": \"<string>\",\n \"custom_note\": \"<string>\",\n \"payment_method_id\": \"pm_1ryTrMj4TTAT1N\"\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.hyperline.co/v1/payments")
.header("Authorization", "Bearer <token>")
.header("Content-Type", "application/json")
.body("{\n \"type\": \"one_time\",\n \"customer_id\": \"cus_Typ0px2W0aiEtl\",\n \"charging_method\": \"immediately\",\n \"items\": [\n {\n \"id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Product name\",\n \"amount\": 123\n }\n ],\n \"products\": [\n {\n \"id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Product name\",\n \"amount\": 123\n }\n ],\n \"purchase_order\": \"<string>\",\n \"custom_note\": \"<string>\",\n \"payment_method_id\": \"pm_1ryTrMj4TTAT1N\"\n}")
.asString();
require 'uri'
require 'net/http'

url = URI("https://api.hyperline.co/v1/payments")

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 \"type\": \"one_time\",\n \"customer_id\": \"cus_Typ0px2W0aiEtl\",\n \"charging_method\": \"immediately\",\n \"items\": [\n {\n \"id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Product name\",\n \"amount\": 123\n }\n ],\n \"products\": [\n {\n \"id\": \"itm_3kXODDF42QXtnL\",\n \"name\": \"Product name\",\n \"amount\": 123\n }\n ],\n \"purchase_order\": \"<string>\",\n \"custom_note\": \"<string>\",\n \"payment_method_id\": \"pm_1ryTrMj4TTAT1N\"\n}"

response = http.request(request)
puts response.read_body
{
  "invoice_id": "<string>",
  "checkout": {
    "id": "<string>",
    "url": "<string>"
  }
}

Authorizations

Authorization
string
header
required

Bearer authentication header of the form Bearer <token>, where <token> is your auth token.

Body

application/json

Create payment payload

type
enum<string>
required

Payment type.

  • one_time: One-time payment, generating one-off invoice.
Available options:
one_time
Example:

"one_time"

customer_id
string
required

ID of the customer.

Example:

"cus_Typ0px2W0aiEtl"

charging_method
enum<string>
required

Charging method.

  • immediately: Customer's payment method will be charged directly to pay the invoice.
  • checkout: Dedicated checkout page will be created for the customer to pay the invoice.
Available options:
immediately
items
object[]
deprecated

Deprecated field, please use products.

Minimum array length: 1
products
object[]

Products composing the related invoice.

Minimum array length: 1
purchase_order
string

Purchase order added on the generated invoice.

custom_note
string

Custom note added on the generated invoice.

payment_method_type
enum<string>

Type of payment method to use to pay the invoice. If not specified, the payment_method_id or the default customer payment method is used.

Available options:
transfer,
external
payment_method_id
string

ID of the payment method to use to pay the invoice. Ignored if payment_method_type is specified.

Example:

"pm_1ryTrMj4TTAT1N"

Response

200 - application/json

The reference to the created invoice and optionally the checkout

invoice_id
string
required

Created invoice ID.

checkout
object

Payment checkout session.