Initialize Payment
To make this request, send an authenticated request to the initiatetrans endpoint.
Initialize a transaction
POST
https://api.oneappgo.com/v1/business/initiatetrans
Headers
authorization*
String
SECRET_KEY
Request Body
amount*
Transaction amount
lname*
String
Customer's last name
fname*
String
Customer's first name
customer_email*
String
Customer's email
reference*
String
Customer's transaction reference
currency*
String
NGN, GHS, ZAR or USD
redirecturl
String
Redirect URL
phone*
String
Customer phone number
meta_data
object
Addition field such as hascommission, subaccount, trackingid etc. See the sample metadata below
"meta_data": {
"subaccount": true,
"trackingid": "T3131122122",
"inflowcomm": "0.3", //leave empty if you would like to use default commission fee you set on dashboard. Pass 0 if you do not want to add any charges
"order_id": 570,
"cart_id": 335,
"tx_id": 518,
"vat": "0",
"storedata": [
{
"name": "Another Clothing",
"products": [
{
"product_id": 285,
"description": "Gorilla T-shirt",
"quantity": 1,
"amount": 50000
}
]
},
{
"name": "Another Clothing 2",
"products": [
{
"product_id": 9085,
"description": "Gucci Bag",
"quantity": 1,
"amount": 165000
}
]
}
]
}
Your secret keys are to be kept secret and only stored on your servers. Do not pass your secret key to front end language where it can be exploited.
Take a look at how you might do this:
curl --location --request POST 'https://api.oneappgo.com/v1/business/initiatetrans' \
--header 'Authorization: Bearer YOUR_SECRET_KEY' \
--form 'reference="fghjkl56789g"' \
--form 'amount="500"' \
--form 'customer_email="[email protected]"' \
--form 'currency="NGN"' \
--form 'redirecturl="https://example.com"' \
--form 'fname="John"' \
--form 'phone= "09012345678"'\,
--form 'lname="Doe"'
Sample response
{
"status": true,
"message": "Successful",
"reference": "2345KDF12",
"access_token": "6983b68c269f7fgha2beb85625288",
"authorization_url": "https://pay.1app.online/checkout/6983b68c269f7fgha2beb85625288/63490b1643375660547"
}
Once the Authorization URL is successfully generated, redirect your users to the authorization_url so they can pay. After payment is completed, the users are redirected to your website using the redirect URL passed with the initialize endpoint.
Last updated
Was this helpful?