Skip to content

Commit

Permalink
Added readme for invoice and cards
Browse files Browse the repository at this point in the history
  • Loading branch information
Hancil Sequeira committed Oct 7, 2021
1 parent 60dea6f commit bfd7829
Show file tree
Hide file tree
Showing 4 changed files with 148 additions and 1 deletion.
19 changes: 19 additions & 0 deletions documents/card.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,19 @@
## Cards

### Fetch card

```php
$api->card->fetch($cardId);
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| cardId* | string | card id to be fetched |

-------------------------------------------------------------------------------------------------------

**PN: * indicates mandatory fields**
<br>
<br>
127 changes: 127 additions & 0 deletions documents/invoice.md
Original file line number Diff line number Diff line change
@@ -0,0 +1,127 @@
## Invoices

### Create Invoice

Request #1
In this example, an invoice is created using the customer and item details. Here, the customer and item are created while creating the invoice.
```php
$api->order->create(array ('type' => 'invoice','description' => 'Invoice for the month of January 2020','partial_payment' => true,'customer' =>array ('name' => 'Gaurav Kumar','contact' => 9999999999,'email' => 'gaurav.kumar@example.com','billing_address' => array ('line1' => 'Ground & 1st Floor, SJR Cyber Laskar','line2' => 'Hosur Road','zipcode' => '560068','city' => 'Bengaluru','state' => 'Karnataka','country' => 'in'),'shipping_address' => array ('line1' => 'Ground & 1st Floor, SJR Cyber Laskar','line2' => 'Hosur Road','zipcode' => '560068','city' => 'Bengaluru','state' => 'Karnataka','country' => 'in')),'line_items' => array (array ('name' => 'Master Cloud Computing in 30 Days','description' => 'Book by Ravena Ravenclaw','amount' => 399,'currency' => 'USD','quantity' => 1)),'sms_notify' => 1,'email_notify' => 1,'currency' => 'USD','expire_by' => 1589765167));
```

Request #2
In this example, an invoice is created using existing `customer_id` and `item_id`
```php
$api->invoice->create(array ('type' => 'invoice','date' => 1589994898, 'customer_id'=> 'cust_E7q0trFqXgExmT', 'line_items'=>array(array('item_id'=>'item_DRt61i2NnL8oy6'))));
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
|type* | string | entity type (here its invoice) |
|description | string | A brief description of the invoice. |
|customer_id | string | customer id for which invoice need be raised |
|customer | array | customer details in a array format |

-------------------------------------------------------------------------------------------------------

### Fetch invoices

```php
$api->invoice->all();
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
|type | string | entity type (here its invoice) |
|payment_id | string | The unique identifier of the payment made by the customer against the invoice. |
|customer_id | string | The unique identifier of the customer. |
|receipt | string | The unique receipt number that you entered for internal purposes. |

-------------------------------------------------------------------------------------------------------

### Fetch invoice

```php
$api->invoice->fetch($invoiceId);
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| invoiceId* | string | The id of the invoice to be fetched |
-------------------------------------------------------------------------------------------------------

### Update invoice

```php
$api->invoice->fetch($invoiceId)->edit(array('line_items' => array(array('id' => 'li_DAweOizsysoJU6','name' => 'Book / English August - Updated name and quantity','quantity' => 1),array('name' => 'Book / A Wild Sheep Chase','amount' => 200,'currency' => 'INR','quantity' => 1)),'notes' => array('updated-key' => 'An updated note.')));
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| invoiceId* | string | The id of the invoice to be fetched |
-------------------------------------------------------------------------------------------------------

### Issues an invoice

```php
$api->invoice->fetch($invoiceId)->issue();
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| invoiceId* | string | The id of the invoice to be issued |
-------------------------------------------------------------------------------------------------------

### Delete an invoice

```php
$api->invoice->fetch($invoiceId)->delete();
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| invoiceId* | string | The id of the invoice to be deleted |
-------------------------------------------------------------------------------------------------------

### Cancel an invoice

```php
$api->invoice->fetch($invoiceId)->cancel();
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| invoiceId* | string | The id of the invoice to be cancelled |
-------------------------------------------------------------------------------------------------------

### Send notification

```php
$api->invoice->fetch($invoiceId)->notify($medium);
```

**Parameters:**

| Name | Type | Description |
|-----------------|---------|------------------------------------------------------------------------------|
| invoiceId* | string | The id of the invoice to be notified |
| medium* | string | `sms`/`email`, Medium through which notification should be sent. |
-------------------------------------------------------------------------------------------------------

**PN: * indicates mandatory fields**
<br>
<br>
**For reference click [here](https://razorpay.com/docs/api/invoices)**
2 changes: 1 addition & 1 deletion documents/order.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,7 +44,7 @@ $api->order->fetch($orderId);

| Name | Type | Description |
|----------|--------|-------------------------------------|
| orderId* | string | The id of the order to be retrieved |
| orderId* | string | The id of the order to be fetched |

-------------------------------------------------------------------------------------------------------

Expand Down
1 change: 1 addition & 0 deletions documents/settlement.md
Original file line number Diff line number Diff line change
Expand Up @@ -44,6 +44,7 @@ $api->settlement->reports(array("year"=>2020,"month"=>09));
|---------------|-------------|---------------------------------------------|
| year* | integer | The year the settlement was received in the `YYYY` format. For example, `2020` |
| month* | integer | The month the settlement was received in the `MM` format. For example, `09` |
| day | integer | The date the settlement was received in the `DD` format. For example, `01` |
| count | integer | number of settlements to fetch (default: 10) |
| skip | integer | number of settlements to be skipped (default: 0) |

Expand Down

0 comments on commit bfd7829

Please sign in to comment.