Shiprocket API in PHP CodeIgniter

Signup in Shiprocket

Shiprocket API implementation in PHP is so easy, Here we will use CodeIgniter Framework,

We will see two processes:

 

  1. Courier to Customer
    To create order/Send a courier through API we have to request cURL “https://apiv2.shiprocket.in/v1/external/orders/create/adhoc” with “token“.
  2. Pickup From Customer
    To Create ‘Return’ through API we have to request cURL “https://apiv2.shiprocket.in/v1/external/orders/create/return” with “token“.

We will see how to create and send token in cURL below.

So let’s get started.

Create a Token in Shiprocket:

This method/Function will return Token, wiil use this token to ‘Create’ and ‘Pickup’ on both process.

Note: Please update CURLOPT_POSTFIELDS value email and password with your detail.

 

So, here you can see complete code example below.

===================================================

Controller

Create a file application/controllers/Shiprocket.php with given code below

(Please go through every line of code to understand the variable values and other things)

View

Create a file application/views/shiprocketView.php with given code below

 

DOWNLOAD

 

Leave a Reply

Your email address will not be published. Required fields are marked *