v1

latestOpenAPI 3.1.02026-07-241080412.6 KB

Create an order

To create an order, you use orders resource. Order resources are used to handle customers' payments of previously defined offers. Orders expire after 24 hours unless the payment is captured. Payment method is required in order entity for payment but can be added in update order.

You should add paymentOperation and subscriptionId parameters for recurring orders.

post/orders

Headers

Content-Typestring
X-Publisher-Tokenstring required

Request body

paymentMethodIdinteger

provided by Cleeng

customerIdinteger required

the identifier of Cleeng customer

offerIdstring required

the identifier for Cleeng offer

currencystring required

customer currency (e.g. USD)

countrystring required

2-letter country code. It is the country code of the country where purchase is made.

couponCodestring

coupon code

taxRatestring

tax rate in float (e.g. '0.23')

customerIPstring

IP address of customer current location. Required conditionally when currency or country not supplied

paymentOperationstring

operation type, e.g. recurring-payment (required on pair with subscriptionId)

subscriptionIdstring

the identifier of Cleeng subscription, e.g. 123123123 (required on pair with paymentOperation)

buyAsAGiftboolean

Whether an order refers to gift purchase

Response

200

successboolean
messagestring

Example response

{
  "success": true,
  "order": {
    "id": 159026691,
    "customerId": 771994569,
    "customer": {
      "locale": "en_US",
      "email": "test@test.com"
    },
    "publisherId": 167631863,
    "offerId": "S398236333_PL",
    "offer": {
      "title": "Title",
      "price": 4.065,
      "currency": "EUR"
    },
    "totalPrice": 9.3217,
    "priceBreakdown": {
      "offerPrice": 4.74,
      "discountAmount": 0.95,
      "discountedPrice": 3.79,
      "taxValue": 0.87,
      "paymentMethodFee": 4.6617
    },
    "taxRate": 0.23,
    "currency": "USD",
    "country": "PL",
    "paymentMethodId": 399207736,
    "expirationDate": 1574333220,
    "billingAddress": {
      "billingStreetName": "street",
      "billingStreetNumber": "123",
      "billingPostalCode": "62-025"
    },
    "couponId": 7,
    "discount": {
      "applied": true,
      "type": "coupon",
      "periods": 10
    },
    "requiredPaymentDetails": true
  },
  "message": "Order created successfully"
}