Giftship Checkout API ⚒️

You can use Giftship to create a multiple shipping address checkout from any platform by using this guide.

View API Documentation:

https://documenter.getpostman.com/view/3477289/RztoNUhL

Checkout API Endpoint:

https://giftship.app/api/checkout/

Step 1:

Generate an API key in Gifship’s settings page within Shopify Admin. Record your access token in a safe place, and ensure that you keep it a secret. Before making API calls, please ensure to enable API access on the same page you generate the token.

Step 2: Making Requests

Set a X-Giftship-Access-Token header using the access token you generated in Giftship’s dashboard with your request.

curl -X POST \
 https://giftship.app/api/checkout/ \
 -H 'Content-Type: application/json' \
 -H 'X-Giftship-Access-Token: YOUR_ACCESS_TOKEN_HERE' \
 -H 'cache-control: no-cache' \
 -d 'YOUR_POST_DATA_HERE'

Make a POST request to the API endpoint at the top of this page, using the following format:

{
 "myshopify_url": "giftship.myshopify.com",
 "line_items": [
 {
 "variant_id": 1537737667856,
 "product_id": 1559202398272,
 "quantity": 1,
 "address": {
 "name": "John Smith",
 "address1": "111 Fake Avenue",
 "address2": "#100",
 "city": "Hollywood",
 "state": "California",
 "country": "United States",
 "zip": "90210",
 "phone": "123-456-7891",
 "company": "Fake Company"
 },
 "properties": {
 "Message": "Put your custom gift message here!",
 "Delivery Date": "02-31-2019"
 }
 },
 {
 "variant_id": 15377370316864,
 "product_id": 1559201742912,
 "quantity": 1,
 "address": {
 "name": "Jane Doe",
 "address1": "123 Test Street",
 "city": "Calgary",
 "state": "Alberta",
 "country": "Canada",
 "zip": "T2X1T9"
 },
 "properties": {
 "Message": "Happy birthday Jane Doe!",
 "Delivery Date": "03-21-2019"
 }
 }
 ],
 "shipping_lines": [
 {
 "name": "UPS 3 Day Ground",
 "price": 3000,
 "address": {
 "name": "Jane Doe",
 "address1": "123 Test Street",
 "city": "Calgary",
 "state": "Alberta",
 "country": "Canada",
 "zip": "T2X1T9"
 }
 }
 ],
 "note_attributes": [
 {
 "name": "Delivery Instructions",
 "value": "Please include the thank you note, and drop on their doorstep",
 "address": {
 "name": "John Smith",
 "address1": "111 Fake Avenue",
 "address2": "#100",
 "city": "Hollywood",
 "state": "California",
 "country": "United States",
 "zip": "90210",
 "phone": "123-456-7891",
 "company": "Fake Company"
 }
 },
 {
 "name": "Delivery Instructions",
 "value": "Please include a happy birthday card",
 "address": {
 "name": "Jane Doe",
 "address1": "123 Test Street",
 "city": "Calgary",
 "state": "Alberta",
 "country": "Canada",
 "zip": "T2X1T9"
 }
 },
 {
 "name": "note",
 "value": "Enter a note here to display on the recreated order",
 "address": {
 "name": "Jane Doe",
 "address1": "123 Test Street",
 "city": "Calgary",
 "state": "Alberta",
 "country": "Canada",
 "zip": "T2X1T9"
 }
 },
 {
 "name": "note",
 "value": "Enter a note here to display on the recreated order",
 "address": {
 "name": "Jane Doe",
 "address1": "123 Test Street",
 "city": "Calgary",
 "state": "Alberta",
 "country": "Canada",
 "zip": "T2X1T9"
 }
 }
 ],
 "note": "ENTER A NOTE FOR THE INITIAL ORDER HERE.",
 "discount": {
 "title": "$10_OFF_CODE",
 "amount": 1000
 },
 "customer_id": 899845193792
}

Step 3: Redirecting to checkout

If all is good, you will receive a response in the following format, which you can then redirect the customer to the checkout_url in order to complete the checkout:

{
 "status": "success",
 "id": 142740652096,
 "checkout_url": "https://giftship.myshopify.com/6542327872/invoices/ef722fdde0d59d268fca0",
 "total_price": "158.58"
}

Examples

Example in cURL/PHP:

<?php

$curl = curl_init();

curl_setopt_array($curl, array(
 CURLOPT_URL => "https://giftship.app/api/checkout/",
 CURLOPT_RETURNTRANSFER => true,
 CURLOPT_ENCODING => "",
 CURLOPT_MAXREDIRS => 10,
 CURLOPT_TIMEOUT => 30,
 CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,
 CURLOPT_CUSTOMREQUEST => "POST",
 CURLOPT_POSTFIELDS => "YOUR_POST_DATA_HERE",
 CURLOPT_HTTPHEADER => array(
 "Content-Type: application/json",
"X-Giftship-Access-Token: YOUR_ACCESS_TOKEN_HERE",
 "cache-control: no-cache"
 ),
));

$response = curl_exec($curl);
$err = curl_error($curl);

curl_close($curl);

if ($err) {
 echo "cURL Error #:" . $err;
} else {
 echo $response;
}

Example in Node:

var http = require("https");

var options = {
"method": "POST",
"hostname": [
"gs",
"appsbypix",
"com"
],
"path": [
"api",
"checkout",
""
],
"headers": {
"Content-Type": "application/json",
"X-Giftship-Access-Token": "YOUR_ACCESS_TOKEN_HERE",
"cache-control": "no-cache",
}
};

var req = http.request(options, function (res) {
var chunks = [];

res.on("data", function (chunk) {
chunks.push(chunk);
});

res.on("end", function () {
var body = Buffer.concat(chunks);
console.log(body.toString());
});
});

req.write(JSON.stringify(YOUR_POST_DATA_HERE));
req.end();

Can't find the answer in our documentation?
Contact Support