Create a Subscription request

For managing subscriptions, the first step is to create one through our Dashboard, specifically in the Subscriptions section. When creating the subscription, you’ll need to specify details such as the amount per period and the duration. Once the subscription is set up, you can use the ID to create subsequent Checkout Preferences, allowing new users to subscribe easily.

  1. Go to ONE dashboard and create a subscription in Subscriptions section

  2. Copy the Subscription ID to be send in the payment_link_id request's field.

Now you’re ready to make the request.

Create a subscription

POST /v1/checkout_preferences

Headers

Name
Value

x-api-key

<your api key>

x-api-secret

<your api secret>

Body

Name
Type
Required
Description

type

string

required ✳️

SUBSCRIPTION

payment_link_id

string

required ✳️

You must include the Subscription ID from your Dashboard as the payment_link_id

origin

string

required ✳️

Use "API" here

external_id

string

optional

Your business entity ID

expiration_date

string

optional

Date in RFC3339 format: yyyy-MM-dd'T'HH:mm:ss'Z' (e.g., 2016-11-01T20:44:39Z). The expiration_date must be no more than one week from the current date. If you don't provide an expiration_date, it will default to 15 minutes.

payer

Object

optional

If you provide the payer’s details in advance, they won’t be asked again at checkout

payer.email

string

optional

Payer's email ie. johndoe@gmail.com

payer.name

string

optional

Payer's name

payer.last_name

string

optional

Payer's last name

payer.phone

string

optional

Payer's phone number

payment_method_types

[]string

optional

List of available payment methods to include in your checkout preference. If none are specified, all payment methods will be enabled by default.

selected_payment_method_id

string

optional

If you provide the ID of a specific payment method, the customer won’t need to choose one at checkout

Example

curl 'https://api.one.lat/v1/checkout_preferences' \
--header 'x-api-key: MY_API_KEY' \
--header 'x-api-secret: MY_API_SECRET' \
--header 'Content-Type: application/json' \
--data-raw '{
    "payment_link_id": ID,
    "origin": "API",
    "external_id": "external_id_1234",
    "type: "SUBCRIPTION",
    "custom_urls": {
        "status_changes_webhook": "https://api.mycompany.io/webhook",
	"success_payment_redirect": "https://mycompany.io/success.html",
	"error_payment_redirect": "https://mycompany.io/error.html"
    },
    "payer": {
        "email": "luca@test.com",
	"phone_number": "+521142567689",
        "first_name": "Luca",
        "last_name": "Dorain"
    },
}'

Last updated