DiscountData
  • API Documentation
  • Introduction
  • Prerequisites
  • Authentication and Authorization
  • Endpoints
    • Get Networks
    • Get Data Plans
    • Buy Data
    • Verify Transaction
    • Get Balance
  • Webhooks
    • Data Purchase Event
    • Pending Purchase Event
    • Unsuccessful Purchase Event
Powered by GitBook
On this page
  1. Endpoints

Buy Data

The Buy Data endpoint allows you to purchase data for mobile numbers effortlessly. By leveraging this endpoint, you can provide your users with seamless connectivity and enable them to enjoy uninterrupted access to mobile data services.

Purchase Data plan for MTN, Glo, Airtel and 9mobile

POST https://app.discountdata.ng/public/api/data

Headers

Name
Type
Description

Authorization*

Bearer

Your API Bearer Token

Request Body

Name
Type
Description

network_id*

String

The Data Plan network ID

plan_id*

String

The Data Plan ID

phone_number*

String

The Recipient Phone Number

ported_number

Boolean

Bypass Number Validator

{
  "success": true,
  "code": 200,
  "status": "successful",
  "message": "Transaction successful",
  "data": {
    "service": "Data Topup",
    "amount": "150",
    "plan": "500MB",
    "phone_number": "0708xxxxxxx",
    "date": "2023-07-12T19:35:40.556395Z",
    "message": "Airtel CORPORATE GIFTING 500MB to 0708xxxxxxx Reference ID Is : #Q5JDTJJUEODXAE",
    "reference": "Q5JDTJJUEODXAE",
    "network": "Airtel",
    "wallet_balance": 4,
    "true_response": "You have successfully gifted 234708xxxxxxxwith 500MB of Data. valid till 8/10/2023 12:00:00 PM. 0708xxxxxxx"
  }
}
{
  "success": false,
  "status": "unsuccessful",
  "message": "Transaction unsuccessful",
  "data": {
    "reference": "O7PRCQOKJFEIOHDND",
    "date": "2023-07-12T19:40:05.972212Z",
    "true_response": " Phone number 0815XXXXXXX isn't an airtel number!. 0815XXXXXXX "
  }
}

This example demonstrates a successful purchase of a 500MB data plan for the mobile number 0708xxxxxxx, which is valid for 30 days. The response includes the purchase and expiry dates for reference.

Please note that the above examples are for illustrative purposes only. Make sure to refer to the detailed documentation and specific data plan requirements to construct the correct requests for purchasing data.

Now that you have an overview of the Buy Data endpoint, you can start integrating it into your application. Please refer to the complete documentation for more details on request and response structures, error handling, and best practices.

If you encounter any difficulties or have questions specific to the Buy Data endpoint, feel free to reach out to our support team for assistance.

Let's proceed to explore the other endpoints provided by the DiscountData API!

PreviousGet Data PlansNextVerify Transaction

Last updated 1 year ago