Create oneclick order

POST
/api/v3/buyers/{buyerId}/oneclick
lts

The endpoint is responsible for purchasing, upgrading, downgrading, and renewing subscriptions for a given product. When this endpoint is used, the system creates a oneclick order and returns its unique identifier, id.

Header parameters
Attribute
Requirement
Description
x-public-key
mandatory
a public key that identifies the merchant account (there can be several for one merchant)
x-buyer-ip
mandatory
is responsible for information about the buyer's IP address
x-date
mandatory
is responsible for the date and time of sending the request
x-token
mandatory
generated on the merchant side
x-source
mandatory
identifier of the type of service that is the initiator of the request
x-id
mandatory
service identifier from which the current request is made
x-google-analytics-client-id
optional
client identifier for Google Analytics
Request parameters
There are rules for creating the request that must be followed:
  1. You cannot perform upgrade, renew, and downgrade simultaneously for the same subscription (subscriptions must be unique).
  2. The set of parameters for purchase differs from those for upgrade, renew, and downgrade.
  3. A single request may contain all actions at once: purchase, upgrade, renew, downgrade.
Attribute
Type
Requirement
Description
Standard
buyerId
string
mandatory
Unique identifier of the buyer in the system.
uuid
currency
string
optional
Specifies the currency in which the prices should be returned.
ISO 4217 Alphabetic
isMobile
bool
mandatory
Indicates whether the request is for the mobile version.
Its value affects the precheckAutocharge settings.
-
chargeMethodId
string
mandatory
Identifier of the customer’s existing payment method.
-
metaData
object
optional
Object of type “key-value”, to transmit the internal meta-information of the merchant
(this data is not used by the backend and is transmitted when sending various events on the order)
-
products
array of objects
mandatory
Array of data describing actions performed on the subscription(s)
-
Response parameters
Regardless of the initial request type (purchase, upgrade, renew, downgrade), the response for each of these requests has a single unified format.
Attribute
Type
Description
data
object
Contains information about the order.
Note: If the request contains a product that does not exist in the database, you will receive an error 404 – Product not found by merchant and code.
meta
object
Provides metadata about the response
{
  "data": {
    "id": "NG1pqx4q"
  },
  "meta": {
    "type": "entity"
  }
}
Errors and interpretation

The list of possible errors for this endpoint, along with their types and interpretation, is provided in the general reference: Endpoint response errors.