3️⃣Create Order

When a user selects an Optty integrated APM, you should send through the order via this method.

Create Order

POST /orders

Once a user checks out and selects a payment method integrated via Optty, send the order information through this method

Headers

NameTypeDescription

Authorization*

String

Bearer <token>

Request Body

NameTypeDescription

orderReference*

string

A unique order reference

bnplProvider*

enum

APM provider name (returned in GET Options). eg: KLARNA_US

purchaseCountry*

string

The country code the purchase is originating from in ISO 3166 alpha-2 format.

eg: US, AU, SG

purchaseCurrency*

string

The country currency the purchase is being made in, using ISO 4217 format. eg: USD, AUD, SGD

locale*

string

The country locale in RFC 1766 standard. eg: en_US

orderAmount*

number

The order amount, including tax, shipping and discount

eg: 14.99

orderItems*

Array

orderItems.name*

string

Name of item in the order eg: "Striped Dress Shirt"

orderItems.quantity*

number

Quantity of the item in the order

eg: 2

orderItems.sku*

number

SKU reference number

eg: "63223448M-1"

orderItems.unitPrice*

number

Price per unit for this item

orderItems.totalAmount*

number

Total amount for this item

taxAmount*

number

The tax amount for the order, pass 0 if none exists. eg: 3.00

shippingAmount*

number

The shipping amount for the order, pass 0 if none exists. eg: 5.00

discountAmount*

number

The discount amount for the order, pass 0 if none exists. eg: 3.00

customer*

object

Details of the customer that is placing the order

customer.firstName*

string

Customer's first name.

customer.lastName*

string

Customer's surname.

customer.email*

string

Customer's email address

customer.phoneNumber*

string

Customer's phone number

billingAddress*

object

Customer's billing address

billingAddress.firstName*

string

Customer's first name to use on billing address

billingAddress.lastName*

string

Customer's surname to use on billing address

billingAddress.email*

string

Email to use on billing address

billingAddress.phoneNumber*

string

Phone number to use on billing address

billingAddress.streetAddress*

string

First line of street name on billing address

billingAddress.streetAddress2*

string

Second line of street name on billing address

billingAddress.city*

string

City on billing address

billingAddress.country*

string

Country on billing address

billingAddress.region*

string

Region on billing address

billingAddress.postalCode*

string

Postcode on billing address

billingAddress.state*

string

State on billing address

shippingAddress

object

Customer's shipping address. Required for Klarna & Afterpay. Recommend sending for all APM's to help with approval rates.

shippingAddress.firstname*

string

Customer's first name to use on shipping address

shippingAddress.lastname*

string

Customer's surname to use on shipping address

shippingAddress.email*

string

Email to use on shipping address

shippingAddress.phoneNumber*

string

Phone number to use on shipping address

shippingAddress.streetAddress*

string

First line of street name on shipping address

shippingAddress.streetAddress2*

string

Second line of street name on shipping address

shippingAddress.city*

string

City on shipping address

shippingAddress.country*

string

Country on shipping address

shippingAddress.region*

string

Region on shipping address

shippingAddress.postalCode*

string

Post code on shipping address

shippingAddress.state*

string

State on shipping address

shippingType

string

Type of shipping service for this order

eg: "standard" , "express"

shippingMethod

enum

The shipping method for this order

[delivery, store, digital, pickup] delivery = normal shipping digital = intangible that doesn't require shipping store - pickup in store (should be store address) pickup - any pick up location

dynamicRedirectURL

string

Redirect to this URL once payment is completed

dynamicCallbackURL

string

Callback URL once payment is completed

sessionID

string

Session ID of the payment

customerToken

string

The <JWT Token> of the customer

Content-type application/json: 

{
    "orderId": "LP000429e48ec-f6e3-49d2-bd38-8e1408d025c8",
    "orderToken": "5d47c4a0-9bfc-406d-9da1-bbc61202c722",
    "redirectUrl": "https://app.uat.latitudepay.com/r/NVXIFQBC",
    "bnplProvider": "LATITUDEPAY_AU",
    "orderReference": "LP000429e48ec-f6e3-49d2-bd38-8e1408d025c8",
    "orderAmount": 144.89,
    "orderPaymentOption": "buy now pay later",
    "orderDate": "2021-10-07T14:30:36.166Z",
    "paymentStatus": "pending"
}

Full Sample Request

Content-type application/json:

{
   "bnplProvider":"LATITUDEPAY_AU",
   "locale":"en_AU",
   "customerToken":"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJjdXN0b21lcklkZW50aWZpZXIiOiI5OWIwODI1MDA4OTUxMDNjMmNjNTNiZmNhMGVlZTNjOTdjMjE2MGM4ZGFhMGM0MmQ4NmI3M2M4NWU5NjA0NTE5ZGEzMDI4MWE3MjlhYzYwMWZjYzMyZDc4ZTdjZmQ1NmJkMjllNjIwZTI2YWU0ZTYzYTRjZTVlOTc2NWE2ZjA3NCIsIm1lcmNoYW50SWQiOiJkNmJiZmQ5Zi02OWZhLTQ3MjgtOTU0YS04MWU0NWI4YWFkMmQiLCJpYXQiOjE2MDE2NjAwMTUsImV4cCI6MTYwMTY2MzYxNX0.Y0UKdtSNPVnJlLN3Xv53Y1_o2AbLPhjxJ1P5O0DSpnE",
   "orderReference":"LP000_OrderID",
   "orderAmount":144.89,
   "taxAmount":6.9,
   "shippingAmount":7.99,
   "discountAmount":0,
   "purchaseCountry":"AU",
   "purchaseCurrency":"AUD",
   "orderItems":[
      {
         "name":"Optty Striped Dress Shirt",
         "quantity":1,
         "sku":"69309284M-1",
         "unitPrice":130,
         "totalAmount":130
      }
   ],
   "customer":{
      "firstName":"Your FirstName",
      "lastName":"Your LastName",
      "email":"test@test.test",
      "phoneNumber":"(415) 200-0000"
   },
   "billingAddress":{
      "firstName":"Your FirstName",
      "lastName":"Your LastName",
      "email":"test@test.test",
      "phoneNumber":"(415) 200-0000",
      "streetAddress":"Your Address",
      "streetAddress2":"Your Address2",
      "city":"Sydney",
      "country":"AU",
      "region":"Oceanian",
      "postalCode":"2000",
      "state": "NSW"
   }
   "shippingAddress":{
      "firstName":"Your FirstName",
      "lastName":"Your LastName",
      "email":"test@test.test",
      "phoneNumber":"(415) 200-0000",
      "streetAddress":"Your Address",
      "streetAddress2":"Your Address2",
      "city":"Sydney",
      "country":"AU",
      "region":"Oceanian",
      "postalCode":"2000",
      "state": "NSW"
   }
   "shippingType": "normal",
   "shippingMethod": "store pick-up",
   "dynamicRedirectUrl": "YOUR_URL"
}

Last updated