Create a charge

Plugin icon

Login with Zip

Give your shoppers the option to Login to your website using Zip and pay seamlessly.

The API call you will make to complete a zip payment is a call to our /charges endpoint. This request is made once you wish to process payment using a customer access_token.

This API call will contain:

  • Customer access token (Bearer key passed as Authorisation header)
  • Your Zip private key (passed as X-Zip-API-Key header)
  • Reference
  • Amount
  • Currency
  • Capture flag

The Zip API response will contain:

  • Charge Id - a unique reference for your charge, to be used for refunds or cancel / capture flows
  • Receipt number - a unique customer facing reference for your charge. To be printed on receipts and is used in legacy 'in-store' refund scenario's.

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

Customer access token

This will have already been obtained in the create token or refresh token Api calls. This should be passed as a Bearer Authorisation header in the POST /charges request. e.g.

Authorization: Bearer <access_token>

Your Zip private key

Zip require your merchant private API key to be passed in the /charges request header. e.g.

X-Zip-API-Key: <APIv2 private key>

Order info

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

  • Reference
  • Amount
  • Currency

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

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

Capture flag

When a charge is made, it must be specified if the funds should be immediately captured or only authorised. In most cases merchants will use immediate capture. This can be passed to Zip as below:

{ 
    "config": {
        "capture": true
     }
}

The full request

An example payload can be found below:

{
    "type": "standard",
    "amount": 200,
    "currency": "aud",
    "account_id": "a2_qrd2jPKDDv",
    "config": {
        "capture": true
    }
}
curl --location --request POST '' \
--header 'Authorization: Bearer <access_token>' \
--header 'X-Zip-API-Key: <api_key>' \
--header 'Content-Type: application/json' \
--data-raw '{
    "type": "standard",
    "amount": 200,
    "currency": "aud",
    "account_id": "a2_6dYobzJde0",
    "config": {
        "capture": true
    }
}'

With a successful response from Zip, you have now completed your charge!


📘

Order Management

  • If you have completed your charge with the capture flag set to false, you will still need to capture or cancel the charge.
  • Additionally, implementing refunds is advised, but not required

📘

Go live

Next its time to review your go live requirements