Endpoints
Payment

Inline

10min

Introduction

With the help of Moolre Payment Link Library, developers can build a simple and secure payment collection process for their web apps.

The integration process are as follows

  1. Initializing Payment
  2. Complete Payment
  3. Verifying Payment
Document image




Initializing Payment

You must initialize the payment from your backend in order to to start processing transactions. This step is crucial as it allows you to maintain complete control over the transaction details. To accomplish this, send a POST request from your backend to the start endpoint.

/embed/pay/start
POST
Request
Header Parameters
X-Api-Pubkey
required
String
Your API Public key
Content-Type
required
String
Set value to "application/json"
Body Parameters
state
required
String
This is the identifier to call for initializing transaction. Use to initialize payment.
accountnumber
required
Integer
Your Moolre account wallet number to use for authentication and transaction.
email
required
String
This is the customer's email address.
currency
required
String
The currency of your wallet. "GHS" - Ghana Cedis
amount
required
Integer
Amount to be paid/debitted from the Customer
reference
required
String
Unique transaction reference. Only -, ., = and alphanumeric characters allowed.
reusable
optional
Boolean
This allows payment link to be reusable. By default, reusable is set to false. Set parameter to be true
callback
optional
String
The user will be redirected to this page after a successful payment.
metadata
optional
Object
This is a stringified JSON object of custom data.
webhook
optional
String
The JSON object is sent to this URL after successful payment has been received, even though this is optional this is where a proper response will be sent with specific details about the transaction




Sample Request and Response

Request
Response


Response Parameters

Parameters

Description

Data Type

status

Status of the api request

  • 1 - Success
  • 0 - Failure

int

code

Unique Identifier for the different possible responses

string

message

Endpoint response message

string

data

An object that contains below parameters:

  • authorization_url: This URL link is used to initialize the payment link. This should be store and sent to you frontend.
  • reference: The unique string used to initialize payment.
  • terminal_id: This is the terminal id to use for GhQR payments.

object



Use public key for this integration

Please you don't need to use your private key with this implementation. What is required for this implementation is your PUBLIC KEY. And also avoid using the key in your frontend.



Complete payment

The frontend application has to send a request to your backend in order to initialize the transaction and obtain the authorization_url. Once your backend has provided the authorization_url, you can load the URL to initialize the transaction.



Verify payment

To verify payment use either webhook (the URL you provided for the initializing payment) or the transactions status endpoint to get the status of the transaction. For the webhook use status and amount , but with the transaction status use txstatus and amount to check if the items or goods should be delivered to the customer or not.



When using the transactions status endpoint Please this enpoint uses X-Api-Key in the header which is your PRIVATE KEY not your PUBLIC KEY. Also do not make this request in your frontend, make the request on your backend and send the response to your frontend.



Sample Response

Below is a sample response for the webhook

JSON




Verify amout

Please always verify the amount when verifying the status of the transaction. Always make sure the amount matches the value of the service being delivered. Never deliver to the customer if the amount doen't match



OTP Bypass

In our effort to make payments more flexible and faster, Moolre introduces a feature that allows bypassing of OTP authentication on all mobile money before payment on specific wallet accounts.

To have this feature enabled on your wallet, contact the Moolre support team by email on [email protected]