/order/create

Define a new Laybuy order and start the payment process. This is a pre-order step.

Recent Requests
Log in to see full request history
TimeStatusUser Agent
Retrieving recent requests…
LoadingLoading…

Overview

This method allows merchants to define a Laybuy order and create a new payment process.

If successful, the merchant should store the token within their system and redirect the customer to the payment URL provided in the response in order to initiate the payment interface.

When a new order is created, any in-progress orders for the same customer (based on the email address) for the merchant will be cancelled.

Any further interactions with any cancelled order will result in an error. If the customer's order changes on the merchant site after the Laybuy order is created, the merchant should restart the process by creating a new order.

Example Request

{
	"amount": 149.98,
	"currency": "NZD",
	"returnUrl": "https://www.merchantsite.com/confirm-payment?i=7437377",
	"merchantReference": "REF-ORD10001",
	"customer": {
		"firstName": "Jenny",
		"lastName": "Smith",
		"email": "[email protected]",
		"phone": "021000000"
	},
	"billingAddress": {
		"address1": "123 Crown Street",
		"city": "Auckland",
		"postcode": "1010",
		"country": "New Zealand"
	},
	"shippingAddress": {
		"name": "Timmy Smith",
		"address1": "Level 4, Goodsmiths Building",
		"address2": "123 Crown Street",
		"suburb": "Redvale",
		"city": "Auckland",
		"postcode": "1010",
		"country": "New Zealand",
		"phone": "0976543211"
	},
	"items": [
    {
      "id": "Item-100001",
      "description": "Blue Widget",
      "quantity": 2,
      "price": 79.99
    },
    {
      "id": "SHIPPING",
      "description": "Shipping",
      "quantity": 1,
      "price": 10.00
    },
    {
      "id": "Discount",
      "description": "Promotional discount",
      "quantity": 1,
      "price": -20
    }
	]
}

Response Data

See the response fields and data returned by the interface and their descriptions on the right - >

Example response - Error

{
	"result": "ERROR",
	"error": "Amount is below the minimum"
}

Example response - Success

{
  "result": "SUCCESS",
  "token": "56e4d02d-f024-3cae-b989-26e3e72e1051",
  "paymentUrl": "https://sandbox-payment.laybuy.com/pay/56e4d02d-f024-3cae-b989-26e3e72e1051"
}
Body Params
number
required
Defaults to 149.98

The total for the customer to pay. This amount is validated against the sum of the amounts in the items attribute..

string
required
Defaults to NZD

The currency of the amount. Only NZD is supported.

string
required
Defaults to https://www.merchantsite.com/confirm-payment

The relative/absolute URL to redirect the customer to once the payment process is completed/declined.

string
required
Defaults to REF-ORD10001

The merchant's unique reference for the order.

number
Defaults to 15.9

The amount of tax contained within amount.

customer
object
required

Container for the customer details.

billingAddress
object

Container for the billing address.

shippingAddress
object

Container for the shipping address.

items
array of objects

Container for the items.

items
Response

Language
Credentials
Basic
base64
:
LoadingLoading…
Response
Click Try It! to start a request and see the response here! Or choose an example:
application/json