Preloader

Purchase Data

.

Endpoint:https://legitsim.com/pay/api/v1/data/create POST
Send the request with parameters shown below:

Request Example (Guzzle)

?php
require_once 'vendor/autoload.php';
$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://legitsim.com/pay/api/v1/data/create', [
    'json' => [
        'client_id' => 'your_client_id',
        'secret_id' => 'your_secret_id',
    ],
    'headers' => [
        'accept' => 'application/json',
        'content-type' => 'application/json',
    ],
]);
echo $response->getBody();


**Response: SUCCESS (200 OK)**

{
  "message": {
    "code": 200,
    "success": ["SUCCESS"]
  },
  "data": {
    "token": "abc123xyztokenstringhere",
    "expire_time": 600
  },
  "type": "success"
}


**Response: ERROR (400 FAILED)**

{
  "message": {
    "code": 400,
    "error": ["Invalid secret ID"]
  },
  "data": [],
  "type": "error"
}

Header: Authorization: Token your_token
HeaderRequiredDescription
Authorization Yes Use format: Authorization: Token your_token

Authenticated Request Example (Guzzle)

?php
require_once 'vendor/autoload.php';

$client = new \GuzzleHttp\Client();
$response = $client->request('POST', 'https://legitsim.com/pay/api/v1/data/create', [
    'headers' => [
        'accept'       => 'application/json',
        'content-type' => 'application/json',
        'Authorization' => 'Token your_token',
    ],
    'json' => [
        // your request payload here
    ],
]);

echo $response->getBody();


Authenticated Request Example (cURL)

?php

// 1. Build JSON body
$body = json_encode([
    'network'       => $payload['network'],
    'mobile_number' => $payload['mobile'],
    'plan'          => $payload['plan'],
    'Ported_number' => true,
]);

// 2. Set endpoint
$endpoint = $payload['url'];
if (!preg_match('#/api/#i', $endpoint)) {
    $endpoint = "https://legitsim.com/pay/api/v1/data/create";
}

// 3. Set secret_id as token
$secret_id = 'your_secret_id';

// 4. cURL
$curl = curl_init();
curl_setopt_array($curl, [
    CURLOPT_URL            => $endpoint,
    CURLOPT_RETURNTRANSFER => true,
    CURLOPT_FOLLOWLOCATION => true,
    CURLOPT_MAXREDIRS      => 10,
    CURLOPT_TIMEOUT        => 30,
    CURLOPT_CUSTOMREQUEST  => 'POST',
    CURLOPT_POSTFIELDS     => $body,
    CURLOPT_HTTPHEADER     => [
        "Authorization: Token $secret_id",
        "Content-Type: application/json",
    ],
]);

$response = curl_exec($curl);
$err = curl_error($curl);
curl_close($curl);

echo $err ?: $response;