{
  "info": {
    "name": "berrapay API",
    "description": "Take Mobile Money and card payments in Ghana. Set the berrapay_key variable to your bp_test_ key to begin. Docs: https://berrapay.com/developers",
    "schema": "https://schema.getpostman.com/json/collection/v2.1.0/collection.json"
  },
  "auth": {
    "type": "bearer",
    "bearer": [
      {
        "key": "token",
        "value": "{{berrapay_key}}",
        "type": "string"
      }
    ]
  },
  "variable": [
    {
      "key": "berrapay_key",
      "value": "bp_test_your_key_here"
    },
    {
      "key": "base",
      "value": "https://berrapay.com/api/v1"
    },
    {
      "key": "id",
      "value": ""
    }
  ],
  "item": [
    {
      "name": "Checkouts",
      "description": "One payment of one amount, paid once. The quickest way to get paid from your own website or app.",
      "item": [
        {
          "name": "Create a checkout",
          "request": {
            "method": "POST",
            "url": "{{base}}/checkouts",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 25.5,\n  \"description\": \"Jollof for two\",\n  \"customer\": {\n    \"name\": \"Ama Mensah\",\n    \"phone\": \"0241234567\"\n  },\n  \"return_url\": \"https://yourshop.com/thanks\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List your checkouts",
          "request": {
            "method": "GET",
            "url": "{{base}}/checkouts",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/checkouts/{{id}}",
            "header": []
          }
        },
        {
          "name": "Cancel one that hasn't been paid",
          "request": {
            "method": "POST",
            "url": "{{base}}/checkouts/{{id}}/cancel",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Invoices",
      "description": "A bill with lines, a discount and tax, addressed to one customer. Can be paid in parts.",
      "item": [
        {
          "name": "Create an invoice",
          "request": {
            "method": "POST",
            "url": "{{base}}/invoices",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"customer\": {\n    \"name\": \"Kwame Boateng\",\n    \"email\": \"kwame@example.com\"\n  },\n  \"items\": [\n    {\n      \"description\": \"Logo design\",\n      \"quantity\": 1,\n      \"unit_price\": 800\n    },\n    {\n      \"description\": \"Business cards\",\n      \"quantity\": 2,\n      \"unit_price\": 150\n    }\n  ],\n  \"allow_partial\": true\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List your invoices",
          "request": {
            "method": "GET",
            "url": "{{base}}/invoices",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/invoices/{{id}}",
            "header": []
          }
        },
        {
          "name": "Cancel one that hasn't been paid",
          "request": {
            "method": "POST",
            "url": "{{base}}/invoices/{{id}}/cancel",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Payment links",
      "description": "A reusable link. Share it anywhere and it can be paid again and again.",
      "item": [
        {
          "name": "Create a link",
          "request": {
            "method": "POST",
            "url": "{{base}}/links",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Tips for the band\",\n  \"description\": \"Pay what you like\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List your links",
          "request": {
            "method": "GET",
            "url": "{{base}}/links",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/links/{{id}}",
            "header": []
          }
        },
        {
          "name": "Stop it taking payments",
          "request": {
            "method": "POST",
            "url": "{{base}}/links/{{id}}/pause",
            "header": []
          }
        },
        {
          "name": "Start it again",
          "request": {
            "method": "POST",
            "url": "{{base}}/links/{{id}}/resume",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Plans and subscriptions",
      "description": "A plan is the offer. A subscription is one customer signed up to it, charged every period.",
      "item": [
        {
          "name": "Create a plan",
          "request": {
            "method": "POST",
            "url": "{{base}}/plans",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Monthly gym membership\",\n  \"amount\": 150,\n  \"interval\": \"monthly\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List your plans",
          "request": {
            "method": "GET",
            "url": "{{base}}/plans",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/plans/{{id}}",
            "header": []
          }
        },
        {
          "name": "Stop new sign-ups",
          "request": {
            "method": "POST",
            "url": "{{base}}/plans/{{id}}/pause",
            "header": []
          }
        },
        {
          "name": "Open it again",
          "request": {
            "method": "POST",
            "url": "{{base}}/plans/{{id}}/resume",
            "header": []
          }
        },
        {
          "name": "List your subscribers",
          "request": {
            "method": "GET",
            "url": "{{base}}/subscriptions",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/subscriptions/{{id}}",
            "header": []
          }
        },
        {
          "name": "Cancel a subscription",
          "request": {
            "method": "POST",
            "url": "{{base}}/subscriptions/{{id}}/cancel",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Charges",
      "description": "A Mobile Money prompt sent to one phone. The customer approves it on their handset within 15 minutes.",
      "item": [
        {
          "name": "Charge a phone",
          "request": {
            "method": "POST",
            "url": "{{base}}/charges",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"amount\": 12,\n  \"phone\": \"0241234567\",\n  \"network\": \"mtn\",\n  \"description\": \"Waakye and egg\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List your charges",
          "request": {
            "method": "GET",
            "url": "{{base}}/charges",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/charges/{{id}}",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Customers",
      "description": "The people who pay you. Anyone who pays is added by berrapay, and you can add them yourself.",
      "item": [
        {
          "name": "Add a customer",
          "request": {
            "method": "POST",
            "url": "{{base}}/customers",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"name\": \"Esi Owusu\",\n  \"phone\": \"0201234567\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "List your customers",
          "request": {
            "method": "GET",
            "url": "{{base}}/customers",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/customers/{{id}}",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Payments",
      "description": "Money that reached you: every successful payment to your account, however it was made. You read these, you don't create them.",
      "item": [
        {
          "name": "List payments received",
          "request": {
            "method": "GET",
            "url": "{{base}}/payments",
            "header": []
          }
        },
        {
          "name": "Get one",
          "request": {
            "method": "GET",
            "url": "{{base}}/payments/{{id}}",
            "header": []
          }
        },
        {
          "name": "List what has happened",
          "request": {
            "method": "GET",
            "url": "{{base}}/events",
            "header": []
          }
        },
        {
          "name": "Get one event",
          "request": {
            "method": "GET",
            "url": "{{base}}/events/{{id}}",
            "header": []
          }
        },
        {
          "name": "Check your key and see your limits",
          "request": {
            "method": "GET",
            "url": "{{base}}/account",
            "header": []
          }
        }
      ]
    },
    {
      "name": "Test mode",
      "item": [
        {
          "name": "Pretend a customer paid",
          "request": {
            "method": "POST",
            "url": "{{base}}/sandbox/pay",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"id\": \"{{id}}\",\n  \"outcome\": \"success\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        },
        {
          "name": "Pretend a payment failed",
          "request": {
            "method": "POST",
            "url": "{{base}}/sandbox/pay",
            "header": [
              {
                "key": "Content-Type",
                "value": "application/json"
              }
            ],
            "body": {
              "mode": "raw",
              "raw": "{\n  \"id\": \"{{id}}\",\n  \"outcome\": \"fail\"\n}",
              "options": {
                "raw": {
                  "language": "json"
                }
              }
            }
          }
        }
      ]
    }
  ]
}