Accept Payment with Cepta Checkout
A Step-by-Step Guide to Building with Cepta Checkout
If you’re looking to integrate Cepta Checkout into your website or application, this guide will walk you through the entire process, from setting up your account to implementing payment processing and handling notifications. With Cepta, you can easily manage payments and create a smooth user experience for your customers. Below, we’ll break down the steps to initialize and verify payments, as well as handle webhooks for real-time updates.
Getting Started with Cepta
Before you can start integrating Cepta Checkout, the first thing you need to do is create an account. Visit the Cepta website and sign up for an account. Once you’ve signed up, you’ll need to access your API keys from the dashboard. These keys are crucial because they authenticate your requests to the Cepta API. Make sure to keep them secure, especially your secret key.
Once you’ve obtained your API keys, you can begin integrating payment processing into your application. If you want to receive real-time updates on payment statuses (such as success or failure), you can set up a webhook to automatically notify your server when these events occur.
Setting Up Webhooks (Optional)
Webhooks are a convenient way to receive real-time notifications about specific events in the payment lifecycle. To set this up, navigate to the webhook section in your Cepta dashboard. You will need to provide a callback URL where Cepta can send the webhook notifications. For instance, this URL could be something like https://example.com/webhook
.
After entering your webhook URL, submit the webhook configuration. Now, whenever a relevant event occurs—such as a payment being processed or completed, Cepta will send a POST
request to your provided URL with all the event details.
To learn more follow the webhook documentation
Initializing a Payment
With your account set up and webhooks configured (if applicable), you can now proceed to the most crucial step: initializing a payment. To start the payment process, you’ll need to make a POST request to the Cepta API to create a payment link. This link will be where your customers can complete their payment.
Here’s an example of how you would initialize a payment:
If everything is set up correctly, the response will include a payment URL and a transaction reference that you can use to verify the payment later.
Here’s an example of a successful response:
The paymentUrl
is where the customer will complete their payment. Simply redirect the customer to this URL, and they’ll be able to proceed with the payment process.
Complete your payment
After payment is completed, they will be redirected to your submitted callbackURL
and you will verify the payment
Verifying the Payment
Once the customer has completed the payment, you need to verify whether the transaction was successful. This can be done by making a GET
request to the Cepta API using the transaction reference that was provided when the payment link was created.
Here’s how you would verify a payment:
This request checks the status of the payment and provides you with a detailed response about the transaction.
A successful verification might look like this:
In the response, the key data points include status
, chargedAmount
, paymentType
and message
.
If the status is “successful” you can safely assume the transaction was successful, and you can proceed with fulfilling the order or providing the purchased goods/services to the customer.
Handling Webhook Notifications
If you’ve set up a webhook for a card payment card.collection.status
, Cepta will automatically send you real-time updates about the payment status. For instance, when a payment is completed successfully, a webhook payload similar to the following will be sent to your server:
You can then handle this data in your system, whether that means updating your order database, sending confirmation emails to customers, or triggering other workflows.
Conclusion
Integrating Cepta Checkout is a straightforward process, and once you’ve set up your account, you can start processing payments with minimal effort. By following the steps outlined in this guide, you can initialize payments, verify them, and optionally set up webhooks to receive real-time notifications of payment events. Whether you’re selling products online or offering services, Cepta provides a reliable and secure way to handle payments.