---
agentTools:
  projectIndex: https://swahilies.readme.io/llms.txt
---

# Create check out order

Initial API to create a check order from your site/app or backend environment

## Body request data

[block:parameters]
{
  "data": {
    "h-0": "Key",
    "h-1": "Uses",
    "0-0": "api_key (required)",
    "0-1": "your api key given after registration",
    "1-0": "order_id (optional)",
    "1-1": "order_id is the reference of the order/transaction from your platform",
    "2-0": "amount (required)",
    "2-1": "the amount to be paid by the user/client",
    "3-0": "code (required) (int)",
    "3-1": "for swahilies purposes default :104",
    "4-0": "api (required) (int)",
    "4-1": "for swahilies purposes\ndefault:170",
    "5-0": "cancel_url (optional)",
    "5-1": "page to redirect when user cancel payment process",
    "6-0": "webhook_url (optional)",
    "6-1": "callback to send response when your successfully makes the payment",
    "7-0": "success_url (optional)",
    "7-1": "page to redirect when user successfully makes the payment",
    "8-0": "metadata",
    "8-1": "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",
    "9-0": "is_live (optional)",
    "9-1": "is_live is boolen put false, for testing purpose to simulate trancation and get callback",
    "10-0": "username",
    "10-1": "name to appear to the user after payment completed e.g \"payment has done to Swahilies INC\""
  },
  "cols": 2,
  "rows": 11
}
[/block]

\##Example code

[block:code]
{
  "codes": [
    {
      "code": "import requests\n\nurl = \"https://swahiliesapi.invict.site/Api\"\n\npayload = \"{\n    \"api\":170,\n    \"code\":101, \n      \"data\":{\n          \"api_key\":\"csdheruvhhjdhvjadmvjehrve\",\n          \"order_id\":\"sdvhdvdvjhv\",\n          \"amount\":50000,\n          \"username\":\"company name\",\n          \"is_live\" :false,\n          \"phone_number\":255783262616,\n          \"cancel_url\":\"wwww.yoursite.com/cancel\",\n          \"webhook_url\":\"www.yoursite.com/response\",\n          \"success_url\":www.yoursite.com/success\",\n          \"metadata\":{\n            \"anykey\":\"anyvalue\",\n            \"another_anyKey\":\n            \"another_anyvalue\"\n          }, \n          \"username\":\"busine name\",\n          \"is_live\" : false\n      }\n   }\"\n\nheaders = {}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)",
      "language": "json"
    }
  ]
}
[/block]

## The above command returns JSON structured like this:

[block:parameters]
{
  "data": {
    "h-0": "Code",
    "h-1": "Message",
    "0-0": "200",
    "0-1": "Success",
    "1-0": "300",
    "1-1": "Error"
  },
  "cols": 2,
  "rows": 2
}
[/block]

[block:callout]
{
  "type": "warning",
  "title": "Note",
  "body": "The page you should redirect for user to make payment is in the ( payment_url )"
}
[/block]

[block:code]
{
  "codes": [
    {
      "code": "{\n    \"code\":200,\n     \"payment_url\":\"https://swahiliespay.invict.site/make-payment-1.html?order=\"+order.order_id\n}",
      "language": "python"
    }
  ]
}
[/block]