Accepting payments with Ziina

This page will get you started accepting payments on your website or mobile application with Ziina.

Accept payments on your website or mobile application using Ziina's Payment Intent API. Create a Payment Intent to generate a payment page for the payment you wish to collect.

Creating a Payment Intent

The PaymentIntent object manages the process of collecting a payment from your customer. To create a PaymentIntent, call the /payment_intent endpoint from your server with the parameters of the payment you wish to collect, including the amount and currency of the payment, and success and cancel URLs.

The amount should be represented as a number in terms of fils, so if you wish to charge 100 AED, the amount parameter should be 10000. The minimum amount for a payment is 2 AED.

The payment page will navigate to the success_url you have specified when the customer completes their payment. Should the customer cancel the payment, the payment page will navigate to the cancel_url you have specified. If you need the Payment Intent ID to be returned in the success or cancel URL, include {PAYMENT_INTENT_ID} in your URL and it will be replaced with the ID of the Payment Intent.

Navigating to the payment page

The Payment Intent response will include a parameter redirect_url, which will be returned to the client to access the payment page. On the client, navigate to this page to allow the customer to complete the payment. They will have the option to pay with credit/debit card and Apple Pay or Google Pay if it is supported by the platform and/or browser.

Once the customer has completed the payment, the browser will navigate to the success_url that was set when creating the Payment Intent.

If the user cancels the payment, the browser will navigate to the cancel_url that was provided when creating the payment.

Fetching a Payment Intent

You can check the status of a Payment Intent by fetching it from the /payment_intent/{id} endpoint. The Payment Intent will include a field status indicating the status of the Payment Intent. The possible values for status are:

  • requires_payment_instrument: The customer has not yet attempted to make the payment.
  • pending: The payment is processing.
  • requires_user_action: The user must complete an action (for example, 3-D Secure authentication) to complete the payment.
  • completed: The payment is complete.
  • failed: The payment has failed. Check the latest_error object on the Payment Intent for a more detailed description of the failure.

Testing your integration

To test your integration, pass the parameter test with value true when creating a Payment Intent. You can complete a test Payment Intent using any card number, expiry, and CVV. No money will be charged.