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

# Create check out order complete card

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

[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\"",
    "11-0": "first_name",
    "11-1": "First name of the billing person",
    "12-0": "last_name",
    "12-1": "Last name of the billing person",
    "13-0": "country_code",
    "13-1": "The country code of the billing person",
    "14-0": "city",
    "14-1": "City\tresident city of the billing person",
    "15-1": "Address of the billing person",
    "15-0": "address"
  },
  "cols": 2,
  "rows": 16
}
[/block]

## Here are a few examples:

[block:code]
{
  "codes": [
    {
      "code": "import requests\n\nurl = \"https://swahiliesapi.invict.site/Api\"\n\npayload = \"{\n    \"api\":170,\n    \"code\":107, \n      \"data\":{\n          \"api_key\":\"your api key\",\n           \"order_id\":\"sdvhdvdvjhv\",\n           \"amount\":50000,\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\":\"another_anyvalue\"\n           }, \n           \"username\":\"busine name\",\n           \"is_live\" : true,\n           \"first_name\":\"erick\",\n           \"last_name\":\"Nyaluke\",\n           \"country_code\":\"TZ\",\n           \"city\":\"Dar es salaam\",\n           \"address\":\"sinza b\"\n      }\n   }\"\n\nheaders = {}\n\nresponse = requests.request(\"POST\", url, headers=headers, data=payload)\n\nprint(response.text)",
      "language": "python"
    }
  ]
}
[/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]