{warning} This API is likely to change before the Beta period is over, please check back regularly to see the latest changes.

Sell a voucher or vouchers

You can use this API endpoint to send us sales, the sale will be processed as if it was places on Smart Gift, an order confirmation email will also be sent so you do not have to worry about processing these yourself.

Request

Headers

POST REQUEST (/sale)

Header: Content-Type - application/json
Header: Accepts - application/json
Header: Smart-Auth sk_XXXXXXXXXXXXXXXXXX

Body

The body of this request must contain at least one item in the cart, a customer and at least a delivery with type and price. The Payment method ID is also required, see the docs for Payment Methods for more info. The order ID should be provided and we will attach it to the order for searching later.


{
    "order_id": 12345, // required
    "payment_method_id": 12, // required
    "cart": [
        {
            "id": "37", // required
            "value": 50.00, // required
            "to": "Jane", // optional
            "from": "John", // optional
            "message": "Thank You!" // optional
        },
        {
            "id": "38", // required
            "value": 215.00 // required
        }
    ],
    "customer": {
        "first_name": "John", // required
        "last_name": "Smith", // required
        "email": "john@smart-gift.co.uk", // required
        "billing_address": { // required
            "line1": "1A Test Street", // required
            "line2": "",
            "line3": "",
            "city": "Test", // required
            "county": "Testings", // required
            "postcode": "T35 TER" // required
        }
    },
    "delivery": {
        "type_id": 1, // required
        "price": 3.99, // required
        "first_name": "Jane",
        "last_name": "Smith",
        "line1": "1A Test Street",
        "line2": "",
        "line3": "",
        "city": "Test",
        "county": "Testings",
        "postcode": "T35 TER",
        "date": "2021-05-20"
    }
}

Response

This API will return an order number and 200 response on a successful order.


{
    "data": {
        "order_id": "oWg9LWe6G"
    }
}