---
agentTools:
  projectIndex: https://developers.commerce.busha.co/llms.txt
---

# Create a payment link

This endpoint is used to create a new payment link. A payment link is an object that represents a payment request to be made by a customer. The response to this request will contain an ID that can be used to retrieve the payment link details.

# OpenAPI definition

```json
{
  "openapi": "3.1.0",
  "info": {
    "title": "Commerce",
    "version": "1.0"
  },
  "servers": [
    {
      "url": "https://api.commerce.busha.co"
    }
  ],
  "security": [
    {}
  ],
  "paths": {
    "/payment_links": {
      "post": {
        "summary": "Create a payment link",
        "description": "This endpoint is used to create a new payment link. A payment link is an object that represents a payment request to be made by a customer. The response to this request will contain an ID that can be used to retrieve the payment link details.",
        "operationId": "create-a-checkout",
        "parameters": [
          {
            "name": "X-BC-API-KEY",
            "in": "header",
            "description": "Your business secret key",
            "required": true,
            "schema": {
              "type": "string"
            }
          }
        ],
        "requestBody": {
          "content": {
            "application/json": {
              "schema": {
                "type": "object",
                "required": [
                  "name",
                  "payment_link_type"
                ],
                "properties": {
                  "name": {
                    "type": "string",
                    "description": "The name of the payment link."
                  },
                  "description": {
                    "type": "string",
                    "description": "A description of the payment link."
                  },
                  "payment_link_type": {
                    "type": "string",
                    "description": "The type of payment link. Can only accept 2 values of either \"donation\" or \"fixed_price\"."
                  },
                  "requested_info": {
                    "type": "array",
                    "description": "The requested information you need from the customer. Can also be an empty array. <br/> <b> N.B </b> You can add additional meta keys apart from name and email used below.",
                    "default": [
                      "name",
                      "email"
                    ],
                    "items": {
                      "type": "string"
                    }
                  },
                  "local_currency": {
                    "type": "string",
                    "description": "The local currency in which the payment link is being created."
                  },
                  "local_amount": {
                    "type": "string",
                    "description": "The amount the customer will pay in the local currency."
                  }
                }
              }
            }
          }
        },
        "responses": {
          "200": {
            "description": "200",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"status\": \"success\",\n    \"message\": \"payment link created successfully\",\n    \"data\": {\n        \"id\": \"74b79191-9c2d-47eb-8021-bbb529e99937\",\n        \"business_id\": \"4d929c30-2899-4cd3-b491-9c6cba7afe06\",\n        \"name\": \"iPhone 7\",\n        \"description\": \"The best iPhone yet\",\n        \"payment_link_type\": \"fixed_price\",\n        \"requested_info\": [\n            \"name\",\n            \"email\"\n        ],\n        \"local_amount\": \"5000\",\n        \"local_currency\": \"NGN\",\n        \"active\": true,\n        \"created_at\": \"2023-02-24T23:05:56.851791358Z\",\n        \"updated_at\": \"2023-02-24T23:05:56.851791452Z\"\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "status": {
                      "type": "string",
                      "example": "success"
                    },
                    "message": {
                      "type": "string",
                      "example": "payment link created successfully"
                    },
                    "data": {
                      "type": "object",
                      "properties": {
                        "id": {
                          "type": "string",
                          "example": "74b79191-9c2d-47eb-8021-bbb529e99937"
                        },
                        "business_id": {
                          "type": "string",
                          "example": "4d929c30-2899-4cd3-b491-9c6cba7afe06"
                        },
                        "name": {
                          "type": "string",
                          "example": "iPhone 7"
                        },
                        "description": {
                          "type": "string",
                          "example": "The best iPhone yet"
                        },
                        "payment_link_type": {
                          "type": "string",
                          "example": "fixed_price"
                        },
                        "requested_info": {
                          "type": "array",
                          "items": {
                            "type": "string",
                            "example": "name"
                          }
                        },
                        "local_amount": {
                          "type": "string",
                          "example": "5000"
                        },
                        "local_currency": {
                          "type": "string",
                          "example": "NGN"
                        },
                        "active": {
                          "type": "boolean",
                          "example": true,
                          "default": true
                        },
                        "created_at": {
                          "type": "string",
                          "example": "2023-02-24T23:05:56.851791358Z"
                        },
                        "updated_at": {
                          "type": "string",
                          "example": "2023-02-24T23:05:56.851791452Z"
                        }
                      }
                    }
                  }
                }
              }
            }
          },
          "400": {
            "description": "400",
            "content": {
              "application/json": {
                "examples": {
                  "Result": {
                    "value": "{\n    \"error\": {\n        \"name\": \"bad_request\",\n        \"message\": \"the local_amount value must be greater than 0\"\n    }\n}"
                  }
                },
                "schema": {
                  "type": "object",
                  "properties": {
                    "error": {
                      "type": "object",
                      "properties": {
                        "name": {
                          "type": "string",
                          "example": "bad_request"
                        },
                        "message": {
                          "type": "string",
                          "example": "the local_amount value must be greater than 0"
                        }
                      }
                    }
                  }
                }
              }
            }
          }
        },
        "deprecated": false,
        "x-readme": {
          "code-samples": [
            {
              "language": "curl",
              "code": "curl --location 'https://api.commerce.busha.co/payment_links' \\\n--header 'X-BC-API-KEY: {SECRET_API_KEY}' \\\n--data '{\n    \"name\": \"iPhone 7\",\n    \"description\": \"The best iPhone yet\",\n    \"payment_link_type\": \"fixed_price\",\n    \"requested_info\": [\"name\", \"email\"],\n    \"local_currency\": \"NGN\",\n    \"local_amount\": \"5000\"\n}'"
            },
            {
              "language": "go",
              "code": "package main\n\nimport (\n  \"fmt\"\n  \"strings\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n\n  url := \"https://api.commerce.busha.co/checkouts\"\n  method := \"POST\"\n\n  payload := strings.NewReader(`{\n    \"name\": \"iPhone 7\",\n    \"description\": \"The best iPhone yet\",\n    \"checkout_type\": \"fixed_price\",\n    \"requested_info\": [\"name\", \"email\"],\n    \"local_currency\": \"NGN\",\n    \"local_amount\": \"5000\"\n}`)\n\n  client := &http.Client {\n  }\n  req, err := http.NewRequest(method, url, payload)\n\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  req.Header.Add(\"X-BC-API-KEY\", \"{SECRET_API_KEY}\")\n  req.Header.Add(\"Content-Type\", \"application/json\")\n  \n  res, err := client.Do(req)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  defer res.Body.Close()\n\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    fmt.Println(err)\n    return\n  }\n  fmt.Println(string(body))\n}"
            },
            {
              "language": "javascript",
              "code": "var myHeaders = new Headers();\nmyHeaders.append(\"X-BC-API-KEY\", \"{SECRET_API_KEY}\");\nmyHeaders.append(\"Content-Type\", \"application/json\");\n\nvar raw = JSON.stringify({\n  \"name\": \"iPhone 7\",\n  \"description\": \"The best iPhone yet\",\n  \"checkout_type\": \"fixed_price\",\n  \"requested_info\": [\n    \"name\",\n    \"email\"\n  ],\n  \"local_currency\": \"NGN\",\n  \"local_amount\": \"5000\"\n});\n\nvar requestOptions = {\n  method: 'POST',\n  headers: myHeaders,\n  body: raw,\n  redirect: 'follow'\n};\n\nfetch(\"https://api.staging.commerce.busha.co/checkouts\", requestOptions)\n  .then(response => response.text())\n  .then(result => console.log(result))\n  .catch(error => console.log('error', error));"
            },
            {
              "language": "php",
              "code": "<?php\n\n$curl = curl_init();\n\ncurl_setopt_array($curl, array(\n  CURLOPT_URL => 'https://api.commerce.busha.co/checkouts',\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_ENCODING => '',\n  CURLOPT_MAXREDIRS => 10,\n  CURLOPT_TIMEOUT => 0,\n  CURLOPT_FOLLOWLOCATION => true,\n  CURLOPT_HTTP_VERSION => CURL_HTTP_VERSION_1_1,\n  CURLOPT_CUSTOMREQUEST => 'POST',\n  CURLOPT_POSTFIELDS =>'{\n    \"name\": \"iPhone 7\",\n    \"description\": \"The best iPhone yet\",\n    \"checkout_type\": \"fixed_price\",\n    \"requested_info\": [\"name\", \"email\"],\n    \"local_currency\": \"NGN\",\n    \"local_amount\": \"5000\"\n}',\n   CURLOPT_HTTPHEADER => array(\n    'X-BC-API-KEY: {SECRET_API_KEY}',\n    'Content-Type: application/json'\n  ),\n));\n\n$response = curl_exec($curl);\n\ncurl_close($curl);\necho $response;\n"
            }
          ],
          "samples-languages": [
            "curl",
            "go",
            "javascript",
            "php"
          ]
        }
      }
    }
  },
  "x-readme": {
    "headers": [],
    "explorer-enabled": true,
    "proxy-enabled": true
  },
  "x-readme-fauxas": true,
  "_id": "63f94c2f2017a0005783edff:63f94f253776b5002eb89826"
}
```