Skip to content

Commit

Permalink
Merge pull request #181 from razorpay/delete_method_v1
Browse files Browse the repository at this point in the history
version upgrade
  • Loading branch information
ankitdas13 authored Jun 9, 2022
2 parents 2ceceac + c27cf44 commit c27cc4d
Show file tree
Hide file tree
Showing 39 changed files with 2,004 additions and 2,017 deletions.
8 changes: 6 additions & 2 deletions README.md
Original file line number Diff line number Diff line change
Expand Up @@ -11,6 +11,8 @@ Documentation of Razorpay's API and their usage is available at <https://docs.ra

Java 1.7 or later

Mock Tests Support till Java 1.8

## Installation

### Maven users
Expand All @@ -21,7 +23,7 @@ Add this dependency to your project's POM:
<dependency>
<groupId>com.razorpay</groupId>
<artifactId>razorpay-java</artifactId>
<version>1.4.0</version>
<version>1.4.1</version>
</dependency>
```

Expand All @@ -30,7 +32,7 @@ Add this dependency to your project's POM:
Add this dependency to your project's build file:

```groovy
compile "com.razorpay:razorpay-java:1.4.0"
compile "com.razorpay:razorpay-java:1.4.1"
```

## Usage
Expand Down Expand Up @@ -62,6 +64,8 @@ razorpayClient.addHeaders(headers);

- [Settlements](documents/settlement.md)

- [Fund](documents/fund.md)

- [Refunds](documents/refund.md)

- [Invoice](documents/invoice.md)
Expand Down
35 changes: 14 additions & 21 deletions documents/addon.md
Original file line number Diff line number Diff line change
Expand Up @@ -5,20 +5,16 @@
```java
String subscriptionId = "sub_I55auG9GnbsR8u";

String jsonRequest =
"{\n" +
" \"item\": {\n" +
" \"name\": \"Extra appala (papadum)\",\n" +
" \"amount\": 30000,\n" +
" \"currency\": \"INR\",\n" +
" \"description\": \"1 extra oil fried appala with meals\"\n" +
" },\n" +
" \"quantity\": 2\n" +
"}";

JSONObject requestJson = new JSONObject(jsonRequest);

Subscription subscription = instance.subscriptions.createAddon(subscriptionId,requestJson);
JSONObject addonRequest = new JSONObject();
JSONObject items = new JSONObject();
items.put("name","Extra appala (papadum)");
items.put("amount","3000");
items.put("currency","INR");
items.put("description","1 extra oil fried appala with meals");
addonRequest.put("item",items);
addonRequest.put("quantity",2);

Addon addon = instance.subscriptions.createAddon(subscriptionId,addonRequest);
```

**Parameters:**
Expand Down Expand Up @@ -64,13 +60,10 @@ Subscription subscription = instance.subscriptions.createAddon(subscriptionId,re
### Fetch all addons

```java
String jsonRequest = "{\n" +
"\"count\" : 1\n" +
"}";
JSONObject params = new JSONObject();
params.put("count","1");

JSONObject requestJson = new JSONObject(jsonRequest);

List<Addon> addon = instance.addons.fetchAll(requestJson);
List<Addon> addon = instance.addons.fetchAll(params);
```

**Parameters:**
Expand Down Expand Up @@ -171,7 +164,7 @@ Addon addon = instance.addons.fetch(addonId);
```java
String addonId = "ao_00000000000001";

instance.addons.delete(addonId)
List<Addon> addon = instance.addons.delete(addonId)
```

**Parameters:**
Expand Down
196 changes: 91 additions & 105 deletions documents/card.md
Original file line number Diff line number Diff line change
Expand Up @@ -2,20 +2,17 @@

### Create customer
```java
String jsonRequest = "{\n" +
" name: \"Gaurav Kumar\",\n" +
" email: \"[email protected]\",\n" +
" contact: \"9123456780\",\n" +
" fail_existing: \"0\",\n" +
" notes:{\n" +
" note_key_1: \"September\",\n" +
" note_key_2: \"Make it so.\"\n" +
" }\n" +
"}";

JSONObject requestJson = new JSONObject(jsonRequest);

Customer customer = instance.customers.create(requestJson);
JSONObject customerRequest = new JSONObject();
customerRequest.put("name","Gaurav Kumar");
customerRequest.put("contact","9123456780");
customerRequest.put("email","[email protected]");
customerRequest.put("fail_existing","0");
JSONObject notes = new JSONObject();
notes.put("notes_key_1","Tea, Earl Grey, Hot");
notes.put("notes_key_2","Tea, Earl Grey… decaf.");
customerRequest.put("notes",notes);

Customer customer = instance.customers.create(customerRequest);
```

**Parameters:**
Expand Down Expand Up @@ -49,26 +46,23 @@ Customer customer = instance.customers.create(requestJson);
### Create Order

```java
String jsonRequest = "{\n" +
" \"amount\":100,\n" +
" \"currency\":\"INR\",\n" +
" \"customer_id\":\"cust_4xbQrmEoA5WJ01\",\n" +
" \"method\":\"card\",\n" +
" \"token\":{\n" +
" \"max_amount\":5000,\n" +
" \"expire_at\":2709971120,\n" +
" \"frequency\":\"monthly\"\n" +
" },\n" +
" \"receipt\":\"Receipt No. 1\",\n" +
" \"notes\":{\n" +
" \"notes_key_1\":\"Tea, Earl Grey, Hot\",\n" +
" \"notes_key_2\":\"Tea, Earl Grey... decaf.\"\n" +
" }\n" +
"}";

JSONObject requestJson = new JSONObject(jsonRequest);

Order order = instance.orders.create(requestJson);
JSONObject orderRequest = new JSONObject();
orderRequest.put("amount", 100);
orderRequest.put("currency", "INR");
orderRequest.put("customer_id", "cust_JDdNazagOgg9Ig");
orderRequest.put("method", "card");
JSONObject token = new JSONObject();
token.put("max_amount","5000");
token.put("expire_at","2709971120");
token.put("frequency","monthly");
orderRequest.put("token", token);
orderRequest.put("receipt", "receipt#1");
JSONObject notes = new JSONObject();
notes.put("notes_key_1","Tea, Earl Grey, Hot");
notes.put("notes_key_2","Tea, Earl Grey… decaf.");
orderRequest.put("notes", notes);

Order order = instance.orders.create(orderRequest);
```

**Parameters:**
Expand All @@ -79,7 +73,7 @@ Order order = instance.orders.create(requestJson);
| currency* | string | The currency of the payment (defaults to INR) |
| customerId* | string | The id of the customer to be fetched |
| receipt | string | Your system order reference id. |
| method* | string | Payment method used to make the registration transaction. Possible value is `card`. |
| method | string | Payment method used to make the registration transaction. Possible value is `card`. |
| token | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#112-create-an-order) are supported |
| notes | object | A key-value pair |

Expand Down Expand Up @@ -116,34 +110,31 @@ Order order = instance.orders.create(requestJson);
### Create registration link

```java
String JsonRequest = "{\n" +
" customer: {\n" +
" name: \"Gaurav Kumar\",\n" +
" email: \"[email protected]\",\n" +
" contact: 9123456780\n" +
" },\n" +
" type: \"link\",\n" +
" amount: 100,\n" +
" currency: \"INR\",\n" +
" description: \"Registration Link for Gaurav Kumar\",\n" +
" subscription_registration: {\n" +
" method: \"card\",\n" +
" max_amount: 500,\n" +
" expire_at: 1609423824\n" +
" },\n" +
" receipt: \"Receipt No. 1\",\n" +
" email_notify: 1,\n" +
" sms_notify: 1,\n" +
" expire_by: 1580479824,\n" +
" notes: {\n" +
" notes_key_1: \"Tea, Earl Grey, Hot\",\n" +
" notes_key_2: \"Tea, Earl Grey... decaf.\"\n" +
" }\n" +
"}";

JSONObject requestJson = new JSONObject(request);

Invoice invoice = instance.invoices.createRegistrationLink(requestJson);
JSONObject registrationLinkRequest = new JSONObject();
JSONObject customer = new JSONObject();
customer.put("name","Gaurav Kumar");
customer.put("email","[email protected]");
customer.put("contact","9123456780");
registrationLinkRequest.put("customer", customer);
registrationLinkRequest.put("type", "link");
registrationLinkRequest.put("amount", 100);
registrationLinkRequest.put("currency", "INR");
registrationLinkRequest.put("description", "Registration Link for Gaurav Kumar");
JSONObject subscriptionRegistration = new JSONObject();
subscriptionRegistration.put("method","card");
subscriptionRegistration.put("max_amount",500);
subscriptionRegistration.put("expire_at",1609423824);
registrationLinkRequest.put("subscription_registration", subscriptionRegistration);
registrationLinkRequest.put("receipt", "Receipt No. 1");
registrationLinkRequest.put("email_notify", 1);
registrationLinkRequest.put("sms_notify", 1);
registrationLinkRequest.put("expire_by", 1580479824);
JSONObject notes = new JSONObject();
notes.put("notes_key_1","Tea, Earl Grey, Hot");
notes.put("notes_key_2","Tea, Earl Grey… decaf.");
registrationLinkRequest.put("notes", notes);

Invoice invoice = instance.invoices.createRegistrationLink(registrationLinkRequest);
```

**Parameters:**
Expand Down Expand Up @@ -225,26 +216,23 @@ Invoice invoice = instance.invoices.createRegistrationLink(requestJson);
## Create an order to charge the customer

```java
String jsonRequest = "{\n" +
" amount: 100,\n" +
" currency: \"INR\",\n" +
" customer_id: \"cust_4xbQrmEoA5WJ01\",\n" +
" method: \"card\",\n" +
" token: {\n" +
" max_amount: 5000,\n" +
" expire_at: 2709971120,\n" +
" frequency: \"monthly\"\n" +
" },\n" +
" receipt: \"Receipt No. 1\",\n" +
" notes: {\n" +
" notes_key_1: \"Tea, Earl Grey, Hot\",\n" +
" notes_key_2: \"Tea, Earl Grey... decaf.\"\n" +
" }\n" +
"}";

JSONObject requestJson = new JSONObject(JsonRequest);

Order order = instance.orders.create(requestJson);
JSONObject orderRequest = new JSONObject();
orderRequest.put("amount", 100);
orderRequest.put("currency", "INR");
orderRequest.put("customer_id", "cust_JDdNazagOgg9Ig");
orderRequest.put("method", "card");
JSONObject token = new JSONObject();
token.put("max_amount","5000");
token.put("expire_at","2709971120");
token.put("frequency","monthly");
orderRequest.put("token", token);
orderRequest.put("receipt", "receipt#1");
JSONObject notes = new JSONObject();
notes.put("notes_key_1","Tea, Earl Grey, Hot");
notes.put("notes_key_2","Tea, Earl Grey… decaf.");
orderRequest.put("notes", notes);

Order order = instance.orders.create(orderRequest);
```
**Parameters:**

Expand All @@ -253,10 +241,11 @@ Order order = instance.orders.create(requestJson);
| amount* | integer | The amount to be captured (should be equal to the authorized amount, in paise) |
| currency* | string | The currency of the payment (defaults to INR) |
| customerId* | string | The id of the customer to be fetched |
| method* | string | Payment method used to make the registration transaction. Possible value is `card`. |
| method | string | Payment method used to make the registration transaction. Possible value is `card`. |
| receipt | string | Your system order reference id. |
| token | array | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/subsequent-payments/#31-create-an-order-to-charge-the-customer) are supported |
| notes | array | A key-value pair |
| payment_capture | boolean | Indicates whether payment status should be changed to captured automatically or not. Possible values: true - Payments are captured automatically. false - Payments are not captured automatically. |

**Response:**
```json
Expand Down Expand Up @@ -291,25 +280,22 @@ Order order = instance.orders.create(requestJson);
## Create a recurring payment

```java
String jsonRequest = "{\n" +
" \"email\": \"[email protected]\",\n" +
" \"contact\": \"9123456789\",\n" +
" \"amount\": 1000,\n" +
" \"currency\": \"INR\",\n" +
" \"order_id\": \"order_1Aa00000000002\",\n" +
" \"customer_id\": \"cust_1Aa00000000001\",\n" +
" \"token\": \"token_1Aa00000000001\",\n" +
" \"recurring\": \"1\",\n" +
" \"description\": \"Creating recurring payment for Gaurav Kumar\",\n" +
" \"notes\": {\n" +
" \"note_key 1\": \"Beam me up Scotty\",\n" +
" \"note_key 2\": \"Tea. Earl Gray. Hot.\"\n" +
" }\n" +
"}";

JSONObject requestJson = new JSONObject(jsonRequest);

Payment payment = instance.payments.createRecurringPayment(requestJson);
JSONObject paymentRequest = new JSONObject();
paymentRequest.put("email", "[email protected]");
paymentRequest.put("contact", "9123456789");
paymentRequest.put("amount", 1000);
paymentRequest.put("currency", "INR");
paymentRequest.put("order_id", "order_1Aa00000000002");
paymentRequest.put("customer_id", "cust_1Aa00000000001");
paymentRequest.put("token", "token_1Aa00000000001");
paymentRequest.put("recurring", 1);
paymentRequest.put("description", "Creating recurring payment for Gaurav Kumar");
JSONObject notes = new JSONObject();
notes.put("notes_key_1","Tea, Earl Grey, Hot");
notes.put("notes_key_2","Tea, Earl Grey… decaf.");
paymentRequest.put("notes", notes);

Payment payment = instance.payments.createRecurringPayment(paymentRequest);
```
**Parameters:**

Expand Down Expand Up @@ -371,7 +357,7 @@ Invoice invoice = instance.invoices.notifyBy(invoiceId,medium);
```java
String invoiceId = "inv_FHrXGIpd3N17DX";

instance.invoices.cancel(invoiceId)
Invoice invoice = instance.invoices.cancel(invoiceId)
```
**Parameters:**

Expand Down Expand Up @@ -561,7 +547,7 @@ List<Token> tokens = instance.customers.fetchTokens(customerId)
```java
String cardId = "card_F0zoXUp4IPPGoI";

Card card=instance.cards.fetch(cardId);
Card card = instance.cards.fetch(cardId);
```

**Parameters:**
Expand Down
Loading

0 comments on commit c27cc4d

Please sign in to comment.