Malum Checkout Form
This guide will walk you through the process of integrating a checkout form on your website using the Malum payment API. The form allows customers to make a payment securely with the provided parameters such as amount, currency, success, and cancel URLs.
Prerequisites
Before proceeding with the integration, ensure you have the following:
Your Malum business ID.
Your Malum private key.
Access to your website's backend to modify PHP files.
2. Generate Signed Message
For security, you must generate a signed message to confirm that the payment request is authentic. This is done using a hash of all the parameters and the private key.
3. Create the Payment Form
The form below sends the payment request to the Malum API via POST when the user clicks the Pay Now button. Each parameter is passed as a hidden input field, including the signed message to verify the request's authenticity.
4. Form Breakdown
action: The form submits to
https://malum.co/api/v3/checkout/form
, which is the endpoint to start the checkout process with Malum.hidden inputs: These fields contain the payment data required by the API. The user will not see these fields, but they are essential for completing the payment.
Pay Now Button: The button triggers the form submission to process the payment.
You can adjust the style of the button with css.
5. Webhook URL
The webhook_url
specifies the location where Malum will send payment results. Make sure the URL points to an endpoint on your server where you can handle the payment notifications.
6. Success and Cancel URLs
When a payment is either successfully completed or canceled, the user will be redirected to these URLs.
Success URL: Redirects the user when the payment is successful.
Cancel URL: Redirects the user when the payment fails or is canceled.
7. Handling the Response
Once the payment is processed, Malum will send a response to your webhook_url
. You need to have a backend process to handle these responses. You can verify the authenticity of the webhook response by checking the signature sent by Malum.
Conclusion
This integration allows you to securely create a payment form using the Malum API and handle payments on your website. With the right API keys and webhook setup, you can manage successful and failed payments seamlessly.
Last updated