Create Order

<Warning title="Warning"> The Readme API Simulator includes form elements for both required and optional Body Params. If not populated with values, Readme will send empty strings to the Clearpay Online API. Any optional parameter that is validated against a Model will need to have all of its required sub-params populated with non-empty values. Therefore, to avoid receiving unexpected "400" responses from Clearpay, please fill out all fields of the simulation form with valid values. This is particularly important for the `amount` and `currency` sub-params of the `totalAmount`, `taxAmount` and `shippingAmount` params. </Warning> ## Successful Response (201) Returns a token and expiry date/time if successful. | Attribute | Type | Description | | :-------- | :----- | :------------------------------------------------------------------------------------------------------------------------------ | | `expires` | string | The UTC timestamp of when the order token will expire, in [ISO 8601](http://www.iso.org/iso/home/standards/iso8601.htm) format. | | `token` | string | Order token to be used to complete payment. | <Note title="Note"> It is not possible to update the order information (including `totalAmount`) after the order token is generated. If the consumer's cart changes on the merchant side after a token is generated, please discard this token. Use the current order information to generate a new order token. Use the new token to send the consumer through the Clearpay screenflow before attempting to [Capture Payment](/v-1/api-reference/online-api/payments/capture-payment). </Note> ## Connection Timeouts | Timeout | Time (Seconds) | | :------ | :------------- | | Open | 10 | | Read | 20 | ## Errors In addition to the [PUT/POST Errors](/v-1/put-post-errors) applicable to all POST endpoints, the following errors are specific to Create Order: | HTTP Status Code | errorCode | Description | | :-- | :-- | :-- | | **422** <br />Unprocessable Entity | `unsupported_payment_type` | The `totalAmount` is outside of the merchant's payment range for Clearpay, as returned by [Get Configuration](/v-1/api-reference/online-api/configuration/get-configuration). | | **422** <br />Unprocessable Entity | `unsupported_currency` | One or more [Money](/v-1/money-object) objects contained a currency that differs from the merchant's account currency. |

Authentication

AuthorizationBasic

Basic authentication of the form Basic <username:password>.

Headers

User-AgentstringRequired
AcceptstringOptionalDefaults to application/json

Request

This endpoint expects an object.
totalAmountobjectRequired
Total amount for order to be charged to consumer.
consumerobjectRequired
The consumer requesting the order.
purchaseCountrystringOptional
The Merchant's store front country. The two-character [ISO 3166-1] (https://en.wikipedia.org/wiki/ISO_3166-1) country code.
billingobjectOptional
Billing address.
shippingobjectOptional
Shipping address.
courierobjectOptional
Shipping Courier details.
descriptionstringOptional
A description of the order.
itemslist of objectsOptional
An array of order items.
discountslist of objectsOptional
An array of discounts.
merchantobjectOptional
merchantReferencestringOptional

The merchant’s id/reference that this order corresponds to.

taxAmountobjectOptional
The included tax amount after applying all discounts.
shippingAmountobjectOptional
The shipping amount.