-
Notifications
You must be signed in to change notification settings - Fork 68
Commit
This commit does not belong to any branch on this repository, and may belong to a fork outside of the repository.
Merge pull request #181 from razorpay/delete_method_v1
version upgrade
- Loading branch information
Showing
39 changed files
with
2,004 additions
and
2,017 deletions.
There are no files selected for viewing
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
This file contains bidirectional Unicode text that may be interpreted or compiled differently than what appears below. To review, open the file in an editor that reveals hidden Unicode characters.
Learn more about bidirectional Unicode characters
Original file line number | Diff line number | Diff line change |
---|---|---|
|
@@ -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:** | ||
|
@@ -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:** | ||
|
@@ -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 | | ||
|
||
|
@@ -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:** | ||
|
@@ -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:** | ||
|
||
|
@@ -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 | ||
|
@@ -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:** | ||
|
||
|
@@ -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:** | ||
|
||
|
@@ -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:** | ||
|
Oops, something went wrong.