Create a Checkout

Plugin icon

Web checkout API

Give your shoppers the option to pay with Zip on your web platform with our web checkout solution.

The first API call you will make in processing a zip payment is a call to our /checkouts endpoint. This request is made once a customer chooses Zip as their payment method for a transaction.

This API call will contain:

  • Customer details
  • Order information
  • Configuration information

The Zip API response will contain:

  • A checkout Id - to identify the newly created checkout
  • A redirect url - to redirect the customer to the zip checkout flow where they will complete their application or log in to their zip account to confirm the payment.

This /checkouts API call should be made from your server and not directly from the client front end.

721721

Customer details

Zip require certain customer details to be passed at the time of checkout as below:

  • First and Last name
  • Email address
  • Mobile phone number
  • Billing Address

Here is an example of how this information can be passed:

"shopper": {
    "title": "Mr",
    "first_name": "Test",
    "last_name": "Tester",
    "email": "[email protected]",
    "phone": "0400000000",
    "billing_address": {
        "first_name": "Test",
        "last_name": "Tester",
        "line1": "10 Spring St",
        "city": "Sydney",
        "state": "NSW",
        "postal_code": "2000",
        "country": "AU"
    }
}

Order information

Zip also require details of the order to be passed in the checkouts request, including:

  • Reference
  • Amount
  • Currency
  • Items

Here are some examples of how this information can be passed:

"order": {
    "reference": "your_order_ reference",
    "amount": 300,
    "currency": "AUD"
}

Items

When a customer fills their cart, these details should be passed in the checkouts request to Zip. Below is an example of how this could look:

"items": [
    {
        "name": "Awesome shoes",
        "amount": 200,
        "quantity": 1,
        "type": "sku",
        "reference": "001",
        "image_uri": "https://yourimage.com/shoes_image_url",
        "item_uri": "https://youritem.com/shoes_item_url"
    },
    {
        "name": "Awesome pants",
        "amount": 100,
        "quantity": 1,
        "type": "sku",
        "reference": "002",
        "image_uri": "https://yourimage.com/pants_image_url",
        "item_uri": "https://youritem.com/pants_item_url"
    }
]

Discounts

The majority of ecommerce websites support some form of discount code or promotion feature. In these scenarios, in order for the checkout sums to add up as expected, Zip require these discount amounts to be passed to us in the /checkouts API call.

The way this should be handled, is by simply adding an additional 'item' to the checkout of 'type: discount' e.g.

"items": [
      {
        "name": "Loyalty Discount",
        "amount": -20,
        "quantity": 1,
        "type": "discount"
      }
]

Pickup vs Delivery

When a customer checks out online, but chooses to pickup the goods in-store rather than have them delivered, it is important that this information is conveyed to Zip in the /checkouts API call.

The primary reason for this is our fraud risk and decisioning engine, which will flag applications as suspicious if the same store address is repeatedly used.

The way this should be handled, is by simply passing 'pickup: true' when calling our API e.g.

"order": {
    "shipping": {
      "pickup": true
    }
}

Alternatively, for a standard online delivery the shipping address should be passed:

"order": {
    "shipping": {
        "pickup": false,
        "address": {
            "first_name": "Test",
            "last_name": "Tester",
            "line1": "10 Spring St",
            "city": "Sydney",
            "state": "NSW",
            "postal_code": "2000",
            "country": "AU"
        }
    }
}

Configuration Information

This is the final part of the checkouts request payload that will give Zip the correct address to return the customer, AFTER they have logged into or signed up to their Zip account.

The 'redirect_uri' is simply your desired url, where Zip will redirect the customer, appending the result and checkout Id

"config": {
    "redirect_uri": "https://yourserver.com.au/zip_order_complete"
}

Here is an example of how Zip would return a successful order confirmation:

https://yourserver.com.au/zip_order_complete?result=Approved&checkoutId=co_xxxxxxxxxxxxxxxx

Platform Identifier

📘

Platfrom Intgerations Only

This is an identifier that must be sent for platform integrations that will have many Zip partners using the one integration.

As a part of all online channel partner certifications, Zip require a piece of metadata to be sent in all requests that identifies the 'Platform' that is processing a transaction.

This is simply passed in all POST /checkouts requests inside the payload within the 'metadata' object.

Below is an isolated example:

"metadata": {
      "platform": "Example Channel Partner"
}

The full request

An example payload can be found below:

{
    "shopper": {
        "title": "Mr",
        "first_name": "Test",
        "last_name": "Tester",
        "email": "[email protected]",
        "phone": "0400000000",
        "billing_address": {
            "first_name": "Test",
            "last_name": "Tester",
            "line1": "10 Spring St",
            "city": "Sydney",
            "state": "NSW",
            "postal_code": "2000",
            "country": "AU"
        }
    },
    "order": {
        "reference": "your_order_reference",
        "amount": 280,
        "currency": "AUD",
        "items": [
            {
                "name": "Awesome shoes",
                "amount": 200,
                "quantity": 1,
                "type": "sku",
                "reference": "001",
                "image_uri": "https://yourimage.com/shoes_image_url",
                "item_uri": "https://youritem.com/shoes_item_url"
            },
            {
                "name": "Awesome pants",
                "amount": 100,
                "quantity": 1,
                "type": "sku",
                "reference": "002",
                "image_uri": "https://yourimage.com/pants_image_url",
                "item_uri": "https://youritem.com/pants_item_url"
            },
            {
                "name": "Loyalty Discount",
                "amount": -20,
                "quantity": 1,
                "type": "discount"
            }
        ],
        "shipping": {
            "pickup": true
        }
    },
    "config": {
        "redirect_uri": "https://yourserver.com.au/zip_order_complete"
    },
    "metadata": {
      "platform": "Example Channel Partner"
    }
}

After you have created a Checkout

Once you have received a successful /checkouts API response, you will need to:

  • Store the 'id' returned by the API against your order / cart records
  • Redirect the customer to the url returned by the API

Once redirected, the customer will see the Zip login screen and either sign in or sign up to their Zip account.

After the customer has completed this step, they will be redirected back to your website. Specifically to your 'redirect_uri' that was passed to Zip in your /checkouts request.

There will be two key values appended to this url that should be consumed by your code and handled appropriately.

https://yourserver.com.au/zip_order_complete?result=Approved&checkoutId=co_xxxxxxxxxxxxxxxx

Result

This is the status of the customer application / order confirmation. This will be one of three possible options:

  • Approved - Proceed to create a charge for this order
  • Declined - Redirect the customer to the payments page to choose an alternative payment option
  • Referred - Redirect the customer to the payments page to choose an alternative payment option

📘

Your order is NOT complete

This result, even if Approved, does not indicate the payment process is complete. This is simply confirmation from Zip that the customer account has the available funds for the order and that both Zip and the customer have approved this checkout ID to be used to create a charge

Checkout id

This is the same value that was stored against your order / cart records after receiving a successful /checkouts API response.

This value should be used to identify the cart associated with the result.



📘

Complete your charge

Once the customer has logged in and Approved the order, you will receive their approval via redirect from Zip and you can then Create the Charge