Initial API to create a card check order from your site/app or backend environment. Create a new order post-checkout from your e-commerce website or app.
Body request data
| Key | Uses |
|---|---|
| api_key (required) | Your api key given after registration |
| order_id (optional) | Order ID is the reference of the order/transaction from your platform |
| amount (required) | The amount to be paid by the user/client |
| code (required) (int) | For swahilies purposes default :104 |
| api (required) (int) | For swahilies purposes default:170 |
| cancel_url (optional) | Page to redirect when user cancel payment process |
| webhook_url (optional) | Callback to send response when your successfully makes the payment |
| success_url (optional) | Page to redirect when user successfully makes the payment |
| metadata | This is a key-value array that user can pass and use the data for future reference they will be returned in the webhook or reconciliation |
| is_live (optional) | is_live is boolen put false, for testing purpose to simulate trancation and get callback |
| username | Name to appear to the user after payment completed e.g "payment has done to Swahilies INC" |
| first_name | First name of the billing person |
| last_name | Last name of the billing person |
| country_code | The country code of the billing person |
| city | City resident city of the billing person |
| address | Address of the billing person |
Here are a few examples:
import requests
url = "https://swahiliesapi.invict.site/Api"
payload = "{
"api":170,
"code":107,
"data":{
"api_key":"your api key",
"order_id":"sdvhdvdvjhv",
"amount":50000,
"phone_number":"255783262616",
"cancel_url":"wwww.yoursite.com/cancel",
"webhook_url":"www.yoursite.com/response",
"success_url":"www.yoursite.com/success",
"metadata":{
"anykey":"anyvalue",
"another_anyKey":"another_anyvalue"
},
"username":"busine name",
"is_live" : true,
"first_name":"erick",
"last_name":"Nyaluke",
"country_code":"TZ",
"city":"Dar es salaam",
"address":"sinza b"
}
}"
headers = {}
response = requests.request("POST", url, headers=headers, data=payload)
print(response.text)
The above command returns JSON structured like this:
| Code | Message |
|---|---|
| 200 | Success |
| 300 | Error |
Note
The page you should redirect for user to make payment is in the ( payment_url )
{
"code":200,
"payment_url":"https://swahiliespay.invict.site/make-payment-1.html?order="+order.order_id
}
