diff --git a/.github/workflows/python.yml b/.github/workflows/python.yml index eed9b5c9..6fa7a3b2 100644 --- a/.github/workflows/python.yml +++ b/.github/workflows/python.yml @@ -13,8 +13,7 @@ on: jobs: deploy: - - runs-on: ubuntu-latest + runs-on: ubuntu-latest # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner strategy: max-parallel: 4 matrix: @@ -30,4 +29,4 @@ jobs: pip install responses python3 setup.py install - name: Run Tests - run: python3 -m unittest \ No newline at end of file + run: python3 -m unittest diff --git a/.github/workflows/security.yml b/.github/workflows/security.yml new file mode 100644 index 00000000..6a035cd4 --- /dev/null +++ b/.github/workflows/security.yml @@ -0,0 +1,51 @@ +name: SecurityChecks +on: + pull_request: {} + push: + branches: ["master"] + schedule: + - cron: '30 20 * * *' +jobs: + semgrep: + name: Scan + runs-on: [ubuntu-latest] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner + steps: + - uses: actions/checkout@v2 + - uses: returntocorp/semgrep-action@v1 + with: + publishToken: ${{ secrets.SEMGREP_APP_TOKEN }} + publishDeployment: 339 + env: + GITHUB_TOKEN: ${{ secrets.GITHUB_TOKEN }} + + workflow_status: + runs-on: [ ubuntu-latest ] # nosemgrep : semgrep.dev/s/swati31196:github_provided_runner + name: Update Status Check + needs: [ semgrep ] + if: always() + env: + githubCommit: ${{ github.event.pull_request.head.sha }} + steps: + - name: Set github commit id + run: | + if [ "${{ github.event_name }}" = "push" ] || [ "${{ github.event_name }}" = "schedule" ]; then + echo "githubCommit=${{ github.sha }}" >> $GITHUB_ENV + fi + exit 0 + - name: Failed + id: failed + if: (contains(needs.*.result, 'failure') || contains(needs.*.result, 'cancelled')) && github.ref != 'refs/heads/master' + run: | + echo 'Failing the workflow for github security status check.' + curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \ + -d '{ "state" : "failure" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }} + exit 1 + - name: Success + if: steps.failed.conclusion == 'skipped' || github.ref != 'refs/heads/master' + run: | + echo 'Status check has passed!' + curl -X POST -H "Content-Type: application/json" -H "Authorization: token ${{ github.token }}" \ + -d '{ "state" : "success" , "context" : "github/security-status-check" , "description" : "github/security-status-check", "target_url" : "https://github.com/${{ github.repository }}" }' \ + https://api.github.com/repos/${{ github.repository }}/statuses/${{ env.githubCommit }} + exit 0 diff --git a/.github/workflows/stale.yml b/.github/workflows/stale.yml new file mode 100644 index 00000000..beb75306 --- /dev/null +++ b/.github/workflows/stale.yml @@ -0,0 +1,29 @@ +# This workflow warns and then closes issues and PRs that have had no activity for a specified amount of time. +# +# You can adjust the behavior by modifying this file. +# For more information, see: +# https://github.com/actions/stale +name: Mark stale issues and pull requests + +on: + schedule: + - cron: '29 1 * * *' # Runs at 01:29 UTC every day. + +jobs: + stale: + + runs-on: ubuntu-latest + permissions: + issues: write + pull-requests: write + + steps: + - uses: actions/stale@v5 + with: + repo-token: ${{ secrets.GITHUB_TOKEN }} + stale-issue-message: 'This issue is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' + stale-pr-message: 'This Pr is stale because it has been open 30 days with no activity. Remove stale label or comment or this will be closed in 7 days' + stale-issue-label: 'Stale' + stale-pr-label: 'Stale' + days-before-stale: 30 + days-before-close: 7 diff --git a/CHANGELOG.md b/CHANGELOG.md index 1ff90c41..443cc83b 100644 --- a/CHANGELOG.md +++ b/CHANGELOG.md @@ -4,6 +4,11 @@ All notable changes to this project will be documented in this file. The format ## Unreleased +## [1.3.1][1.3.1] - 2022-07-01 + +- Added Third party validation & Otp API for Payment (createUpi, validateVpa, otpGenerate, otpSubmit, otpResend) +- Update Documention + ## [1.3.0][1.3.0] - 2022-02-01 ### Added diff --git a/README.md b/README.md index 2cc9c783..7b1e92ec 100644 --- a/README.md +++ b/README.md @@ -43,6 +43,8 @@ that both app title and version are strings. - [Token](documents/token.md) +- [Fund](documents/fund.md) + - [Order](documents/order.md) - [Payments](documents/payment.md) diff --git a/documents/addon.md b/documents/addon.md index 74b8f3be..f2abc853 100644 --- a/documents/addon.md +++ b/documents/addon.md @@ -19,8 +19,8 @@ client.subscription.createAddon('sub_I55auG9GnbsR8u',{ | Name | Type | Description | |-------|-----------|--------------------------------------------------| | subscriptionId* | boolean | The subscription ID to which the add-on is being added. | -| items* | object | Details of the add-on you want to create. | -| quantity* | integer | This specifies the number of units of the add-on to be charged to the customer. | +| items | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-an-add-on) | +| quantity | integer | This specifies the number of units of the add-on to be charged to the customer. | **Response:** ```json diff --git a/documents/card.md b/documents/card.md index ee9a453f..1aad8183 100644 --- a/documents/card.md +++ b/documents/card.md @@ -46,13 +46,20 @@ client.customer.create({ ```py client.order.create({ - "amount": 50000, - "currency": "INR", - "receipt": "receipt#1", - "notes": { - "key1": "value3", - "key2": "value2" - } + "amount":100, + "currency":"INR", + "customer_id":"cust_4xbQrmEoA5WJ01", + "method":"card", + "token":{ + "max_amount":5000, + "expire_at":2709971120, + "frequency":"monthly" + }, + "receipt":"Receipt No. 1", + "notes":{ + "notes_key_1":"Tea, Earl Grey, Hot", + "notes_key_2":"Tea, Earl Grey... decaf." + } }) ``` @@ -62,24 +69,35 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | 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 | | receipt | string | Your system order reference id. | +| 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 | **Response:** ```json { - "id": "order_EKwxwAgItmmXdp", + "id": "order_JmugUU7mFbXTRN", "entity": "order", - "amount": 50000, + "amount": 100, "amount_paid": 0, - "amount_due": 50000, + "amount_due": 100, "currency": "INR", - "receipt": "receipt#1", + "receipt": "Receipt No. 1", "offer_id": null, "status": "created", "attempts": 0, - "notes": [], - "created_at": 1582628071 + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey... decaf." + }, + "created_at": 1656418993, + "token": { + "max_amount": 5000, + "expire_at": 2709971120 + }, + "method": "card" } ``` ------------------------------------------------------------------------------------------------------- @@ -117,8 +135,7 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | -| type* | string | the value is `link`. | +| customer | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/cards/authorization-transaction/#121-create-a-registration-link) are supported | | 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) | | description* | string | A brief description of the payment. | @@ -515,8 +532,24 @@ client.card.fetch(cardId) | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| cardId* | string | card id to be fetched | +| cardId* | string | card id to be fetched | +**Response:** +```json +{ + "id": "card_JXPULjlKqC5j0i", + "entity": "card", + "name": "Gaurav", + "last4": "4366", + "network": "Visa", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": null +} +``` ------------------------------------------------------------------------------------------------------- ## Delete tokens diff --git a/documents/customer.md b/documents/customer.md index a2ec5716..157ac127 100644 --- a/documents/customer.md +++ b/documents/customer.md @@ -90,8 +90,8 @@ client.customer.all(options) | Name | Type | Description | |---------------|-------------|---------------------------------------------| -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| count | integer | number of customers to fetch (default: 10) | +| skip | integer | number of customers to be skipped (default: 0) | **Response:** ```json diff --git a/documents/emandate.md b/documents/emandate.md index 2ed07424..755b7593 100644 --- a/documents/emandate.md +++ b/documents/emandate.md @@ -49,12 +49,13 @@ client.customer.create({ client.order.create({ "amount": 0, "currency": "INR", + "payment_capture": True, "method": "emandate", "customer_id": "cust_1Aa00000000001", "receipt": "Receipt No. 1", "notes": { "notes_key_1": "Beam me up Scotty", - "notes_key_2": "Engage" + "notes_key_2": "Engage" }, "token": { "auth_type": "netbanking", @@ -81,13 +82,15 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | method* | string | The authorization method. In this case the value will be `emandate` | -| receipt | string | Your system order reference id. | +| receipt | string | Your system order reference id. | +| customer_id* | string | The `customer_id` for the customer you want to charge.| | 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. | | notes | object | A key-value pair | -| token | object | A key-value pair | +| token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#112-create-an-order) are supported| **Response:** Create order response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#112-create-an-order) + ------------------------------------------------------------------------------------------------------- ### Create an Authorization Payment @@ -136,16 +139,20 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | +| customer* | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#121-create-a-registration-link) are supported | | type* | string | In this case, the value is `link`. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | amount* | integer | The payment amount in the smallest currency sub-unit. | | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | -| subscription_registration | object | Details of the authorization payment. | -| notes | object | A key-value pair | +| subscription_registration | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/emandate/create-authorization-transaction/#121-create-a-registration-link) are supported | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| receipt | string | Your system order reference id. | +| notes | array | A key-value pair | **Response:** Create registration link response please click [here](https://razorpay.com/docs/api/recurring-payments/emandate/authorization-transaction/#121-create-a-registration-link) + ------------------------------------------------------------------------------------------------------- ### Send/Resend notifications @@ -371,6 +378,7 @@ client.token.delete(customerId,tokenId) client.order.create({ "amount":1000, "currency":"INR", + "payment_capture": True, "receipt":"Receipt No. 1", "notes": { "notes_key_1":"Tea, Earl Grey, Hot", @@ -386,8 +394,8 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | -| notes | object | 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. | +| notes | object | 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 diff --git a/documents/fund.md b/documents/fund.md index 6b8f1228..c6d6d6ed 100644 --- a/documents/fund.md +++ b/documents/fund.md @@ -24,18 +24,20 @@ client.fund_account.create({ **Response:** ```json { - "id":"fa_Aa00000000001", - "entity":"fund_account", - "customer_id":"cust_Aa000000000001", - "account_type":"bank_account", - "bank_account":{ - "name":"Gaurav Kumar", - "account_number":"11214311215411", - "ifsc":"HDFC0000053", - "bank_name":"HDFC Bank" + "id": "fa_JexSeA2SS1S19D", + "entity": "fund_account", + "customer_id": "cust_JdumbHq5F3kKu6", + "account_type": "bank_account", + "bank_account": { + "ifsc": "HDFC0000053", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "notes": [], + "account_number": "11214311215411" }, - "active":true, - "created_at":1543650891 + "batch_id": null, + "active": true, + "created_at": 1654682051 } ``` ------------------------------------------------------------------------------------------------------- @@ -43,7 +45,7 @@ client.fund_account.create({ ### Fetch all fund accounts ```py -client.fund_account.fetch(customerId) +client.fund_account.all({"customer_id":customerId}) ``` **Parameters:** @@ -55,18 +57,42 @@ client.fund_account.fetch(customerId) **Response:** ```json { - "id":"fa_Aa00000000001", - "entity":"fund_account", - "customer_id":"cust_Aa000000000001", - "account_type":"bank_account", - "bank_account":{ - "name":"Gaurav Kumar", - "account_number":"11214311215411", - "ifsc":"HDFC0000053", - "bank_name":"HDFC Bank" - }, - "active":true, - "created_at":1543650891 + "entity": "collection", + "count": 2, + "items": [ + { + "id": "fa_JcXaLomo4ck5IY", + "entity": "fund_account", + "customer_id": "cust_JZse2vlC5nK9AQ", + "account_type": "bank_account", + "bank_account": { + "ifsc": "HDFC0000053", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "notes": [], + "account_number": "11214311215411" + }, + "batch_id": null, + "active": true, + "created_at": 1654154246 + }, + { + "id": "fa_JcXYtecLkhW74k", + "entity": "fund_account", + "customer_id": "cust_JZse2vlC5nK9AQ", + "account_type": "bank_account", + "bank_account": { + "ifsc": "HDFC0000053", + "bank_name": "HDFC Bank", + "name": "Gaurav Kumar", + "notes": [], + "account_number": "11214311215411" + }, + "batch_id": null, + "active": true, + "created_at": 1654154163 + } + ] } ``` ------------------------------------------------------------------------------------------------------- diff --git a/documents/invoice.md b/documents/invoice.md index 59fda466..1201be93 100644 --- a/documents/invoice.md +++ b/documents/invoice.md @@ -8,7 +8,7 @@ In this example, an invoice is created using the customer and item details. Here client.invoice.create({ "type": "invoice", "description": "Invoice for the month of January 2020", - "partial_payment": 1, + "partial_payment": true, "customer": { "name": "Gaurav Kumar", "contact": 9999999999, @@ -16,7 +16,7 @@ client.invoice.create({ "billing_address": { "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", - "zipcode": 560068, + "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" @@ -24,7 +24,7 @@ client.invoice.create({ "shipping_address": { "line1": "Ground & 1st Floor, SJR Cyber Laskar", "line2": "Hosur Road", - "zipcode": 560068, + "zipcode": "560068", "city": "Bengaluru", "state": "Karnataka", "country": "in" @@ -35,7 +35,7 @@ client.invoice.create({ "name": "Master Cloud Computing in 30 Days", "description": "Book by Ravena Ravenclaw", "amount": 399, - "currency": "USD", + "currency": "USD", "quantity": 1 } ], @@ -52,9 +52,10 @@ client.invoice.create({ |-----------------|---------|------------------------------------------------------------------------------| |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 | -|line_items* | array | Details of the line item that is billed in the invoice. | +|customer_id | string | customer id for which invoice need be raised | +|draft | string | Invoice is created in draft state when value is set to `1` | +| customer* | array | All parameters listed [here](https://razorpay.com/docs/api/payments/invoices/#create-an-invoice) are supported | +| line_items | array | All parameters listed [here](https://razorpay.com/docs/api/payments/invoices/#create-an-invoice) are supported | |expire_by | array | Details of the line item that is billed in the invoice. | |sms_notify | array | Details of the line item that is billed in the invoice. | |email_notify | array | Details of the line item that is billed in the invoice. | @@ -250,10 +251,98 @@ client.invoice.edit(invoiceId,{ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | invoiceId* | string | The id of the invoice to be fetched | +| line_items | array | All parameters listed [here](https://razorpay.com/docs/api/payments/invoices/#update-an-invoice) are supported | +| notes | array | key value pair | **Response:** -For update invoice response please click [here](https://razorpay.com/docs/api/invoices/#update-an-invoice) - +```json +{ + "id": "inv_DAweOiQ7amIUVd", + "entity": "invoice", + "receipt": "#0961", + "invoice_number": "#0961", + "customer_id": "cust_DAtUWmvpktokrT", + "customer_details": { + "id": "cust_DAtUWmvpktokrT", + "name": "Gaurav Kumar", + "email": "gaurav.kumar@example.com", + "contact": "9977886633", + "gstin": null, + "billing_address": { + "id": "addr_DAtUWoxgu91obl", + "type": "billing_address", + "primary": true, + "line1": "318 C-Wing, Suyog Co. Housing Society Ltd.", + "line2": "T.P.S Road, Vazira, Borivali", + "zipcode": "400092", + "city": "Mumbai", + "state": "Maharashtra", + "country": "in" + }, + "shipping_address": null, + "customer_name": "Gaurav Kumar", + "customer_email": "gaurav.kumar@example.com", + "customer_contact": "9977886633" + }, + "order_id": null, + "line_items": [ + { + "id": "li_DAweOizsysoJU6", + "item_id": null, + "name": "Book / English August - Updated name and quantity", + "description": "150 points in Quidditch", + "amount": 400, + "unit_amount": 400, + "gross_amount": 400, + "tax_amount": 0, + "taxable_amount": 400, + "net_amount": 400, + "currency": "INR", + "type": "invoice", + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "unit": null, + "quantity": 1, + "taxes": [] + } + ], + "payment_id": null, + "status": "draft", + "expire_by": 1567103399, + "issued_at": null, + "paid_at": null, + "cancelled_at": null, + "expired_at": null, + "sms_status": null, + "email_status": null, + "date": 1566891149, + "terms": null, + "partial_payment": false, + "gross_amount": 600, + "tax_amount": 0, + "taxable_amount": 600, + "amount": 600, + "amount_paid": null, + "amount_due": null, + "currency": "INR", + "currency_symbol": "₹", + "description": "This is a test invoice.", + "notes": { + "updated-key": "An updated note." + }, + "comment": null, + "short_url": null, + "view_less": true, + "billing_start": null, + "billing_end": null, + "type": "invoice", + "group_taxes_discounts": false, + "created_at": 1566906474, + "idempotency_key": null +} +``` ------------------------------------------------------------------------------------------------------- ### Issue an invoice diff --git a/documents/items.md b/documents/items.md index 7d48dfc2..6231894f 100644 --- a/documents/items.md +++ b/documents/items.md @@ -23,12 +23,22 @@ client.item.create({ **Response:** ```json { - "id": "item_7Oxp4hmm6T4SCn", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, - "currency": "INR" + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ``` @@ -47,36 +57,31 @@ client.item.all(options) | to | timestamp | timestamp before which the item were created | | count | integer | number of item to fetch (default: 10) | | skip | integer | number of item to be skipped (default: 0) | +| active | integer | Fetches number of active or inactive items. The value is `1` for active items and `0` for inactive items. | **Response:** ```json { "entity": "collection", - "count": 3, + "count": 1, "items": [ { - "id": "item_7Oy8OMV6BdEAac", - "active": true, - "name": "Book / Ignited Minds", - "description": null, - "amount": 15000, - "currency": "INR" - }, - { - "id": "item_7Oxp4hmm6T4SCn", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, - "currency": "INR" - }, - { - "id": "item_7OxoGnoxCuUKbo", - "active": true, - "name": "Book / English August", - "description": null, - "amount": 20000, - "currency": "INR" + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ] } @@ -96,12 +101,22 @@ client.item.fetch(itemId) **Response:** ```json { - "id": "item_7Oxp4hmm6T4SCn", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / English August", "description": "An indian story, Booker prize winner.", "amount": 20000, - "currency": "INR" + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ``` @@ -115,7 +130,7 @@ client.item.edit(itemId,{ "description": "New descirption too. :).", "amount": 20000, "currency": "INR", - "active": true + "active": True }) ``` **Parameters** @@ -132,12 +147,22 @@ client.item.edit(itemId,{ **Response:** ```json { - "id": "item_7Oy8OMV6BdEAac", + "id": "item_JnQ2kRGq8Kbte3", "active": true, "name": "Book / Ignited Minds - Updated name!", - "description": "New descirption too. :)", - "amount": 15000, - "currency": "INR" + "description": "New descirption too. :).", + "amount": 20000, + "unit_amount": 20000, + "currency": "INR", + "type": "invoice", + "unit": null, + "tax_inclusive": false, + "hsn_code": null, + "sac_code": null, + "tax_rate": null, + "tax_id": null, + "tax_group_id": null, + "created_at": 1656529427 } ``` ------------------------------------------------------------------------------------------------------- diff --git a/documents/order.md b/documents/order.md index 24ddfbe5..85815caa 100644 --- a/documents/order.md +++ b/documents/order.md @@ -7,6 +7,7 @@ client.order.create({ "amount": 50000, "currency": "INR", "receipt": "receipt#1", + "partial_payment":False, "notes": { "key1": "value3", "key2": "value2" @@ -45,6 +46,54 @@ client.order.create({ ------------------------------------------------------------------------------------------------------- +### Create order (Third party validation) + +```py +client.order.create({ + "amount": 500, + "method": "netbanking", + "receipt": "BILL13375649", + "currency": "INR", + "bank_account": { + "account_number": "765432123456789", + "name": "Gaurav Kumar", + "ifsc": "HDFC0000053" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| amount* | integer | Amount of the order to be paid | +| method | string | The payment method used to make the payment. If this parameter is not passed, customers will be able to make payments using both netbanking and UPI payment methods. Possible values is `netbanking` or `upi`| +| currency* | string | Currency of the order. Currently only `INR` is supported. | +| receipt | string | Your system order reference id. | +| notes | array | A key-value pair | +|bank_account | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/#step-2-create-an-order) are supported | + +**Response:** + +```json +{ + "id": "order_GAWN9beXgaqRyO", + "entity": "order", + "amount": 500, + "amount_paid": 0, + "amount_due": 500, + "currency": "INR", + "receipt": "BILL13375649", + "offer_id": null, + "status": "created", + "attempts": 0, + "notes": [], + "created_at": 1573044247 +} +``` + +------------------------------------------------------------------------------------------------------- + ### Fetch all orders ```py @@ -61,6 +110,9 @@ client.order.all(option) | skip | integer | number of orders to be skipped (default: 0) | | authorized | boolean | Orders for which orders are currently in authorized state. | | receipt | string | Orders with the provided value for receipt. | +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `payments`,`payments.card`,`transfers` or `virtual_account` | +| authorized | boolean | Possible value is `0` or `1` | + **Response:** @@ -103,17 +155,21 @@ client.order.fetch(orderId) ```json { - "id":"order_DaaS6LOUAASb7Y", - "entity":"order", - "amount":2200, - "amount_paid":0, - "amount_due":2200, - "currency":"INR", - "receipt":"Receipt #211", - "status":"attempted", - "attempts":1, - "notes":[], - "created_at":1572505143 + "id": "order_Jc81IZnaXSMLFh", + "entity": "order", + "amount": 50000, + "amount_paid": 50000, + "amount_due": 0, + "currency": "INR", + "receipt": null, + "offer_id": null, + "status": "paid", + "attempts": 1, + "notes": { + "notes_key_1": "value1", + "notes_key_2": "value2" + }, + "created_at": 1654064215 } ``` ------------------------------------------------------------------------------------------------------- @@ -121,7 +177,7 @@ client.order.fetch(orderId) ### Fetch payments for an order ```py -client.order.payment(orderId) +client.order.payments(orderId) ``` **Parameters** @@ -132,35 +188,46 @@ client.order.payment(orderId) **Response:** ```json { - "entity":"collection", - "count":1, - "items":[ + "entity": "collection", + "count": 1, + "items": [ { - "id":"pay_DaaSOvhgcOfzgR", - "entity":"payment", - "amount":2200, - "currency":"INR", - "status":"captured", - "order_id":"order_DaaS6LOUAASb7Y", - "invoice_id":null, - "international":false, - "method":"card", - "amount_refunded":0, - "refund_status":null, - "captured":true, - "description":"Beans in every imaginable flavour", - "card_id":"card_DZon6fd8J3IcA2", - "bank":null, - "wallet":null, - "vpa":null, - "email":"gaurav.kumar@example.com", - "contact":"+919999999988", - "notes":[], - "fee":44, - "tax":0, - "error_code":null, - "error_description":null, - "created_at":1572505160 + "id": "pay_Jc81alhu5LmAUI", + "entity": "payment", + "amount": 50000, + "currency": "INR", + "status": "captured", + "order_id": "order_Jc81IZnaXSMLFh", + "invoice_id": "inv_Jc81IWvxf4TT1F", + "international": false, + "method": "upi", + "amount_refunded": 0, + "refund_status": null, + "captured": true, + "description": "Order # 2", + "card_id": null, + "bank": null, + "wallet": null, + "vpa": "success@razorpay", + "email": "sofiya.shaikh2@razorpay.com", + "contact": "+919702219003", + "customer_id": "cust_JR4BVKjKyJ7enk", + "token_id": "token_Jc81b6OBfodoi6", + "notes": { + "opencart_order_id": "2" + }, + "fee": 1180, + "tax": 180, + "error_code": null, + "error_description": null, + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "rrn": "001000100002", + "upi_transaction_id": "npci_txn_id_for_Jc81alhu5LmAUI" + }, + "created_at": 1654064232 } ] } diff --git a/documents/papernach.md b/documents/papernach.md index 9b2ea32e..fcc5c7d4 100644 --- a/documents/papernach.md +++ b/documents/papernach.md @@ -23,6 +23,7 @@ client.customer.create({ | email | string | Email of the customer | | contact | string | Contact number of the customer | | notes | object | A key-value pair | +| fail_existing | string | If a customer with the same details already exists, the request throws an exception by default. Possible value is `0` or `1`| **Response:** ```json @@ -46,56 +47,50 @@ client.customer.create({ ```py client.order.create({ - "amount": 0, - "currency": "INR", - "method": "emandate", + "amount":0, + "currency":"INR", + "method":"nach", "customer_id": "cust_1Aa00000000001", - "receipt": "Receipt No. 1", + "receipt":"Receipt No. 1", "notes": { "notes_key_1": "Beam me up Scotty", - "notes_key_2": "Engage" + "notes_key_2": "Engage" }, - "token": { - "auth_type": "netbanking", - "max_amount": 9999900, - "expire_at": 4102444799, + "token":{ + "auth_type":"physical", + "max_amount":10000000, + "expire_at":2709971120, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, - "bank_account": { - "beneficiary_name": "Gaurav Kumar", - "account_number": 1121431121541121, - "account_type": "savings", - "ifsc_code": "HDFC0000001" + "bank_account":{ + "account_number":"11214311215411", + "ifsc_code":"HDFC0000001", + "beneficiary_name":"Gaurav Kumar", + "account_type":"savings" + }, + "nach":{ + "form_reference1":"Recurring Payment for Gaurav Kumar", + "form_reference2":"Method Paper NACH", + "description":"Paper NACH Gaurav Kumar" } } }) ``` **Parameters:** -| Name | Type |Description | + +| Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| | 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 `nach`. | | receipt | string | Your system order reference id. | -| token.auth_type* | string | Possible value is `physical`| -| token.max_amount | integer | Use to set the maximum amount per debit request. The value can range from `500` - `1000000000` (1cr, default value) | -| token.expire_at | integer | The timestamp, in Unix format, till when the registration link should expire | -| token.notes | object | A key-value pair | -| bank.account_number* | string | Customer's bank account number. | -| bank.ifsc_code* | string | Customer's bank IFSC | -| bank.beneficiary_name* | string | Customer's name | -| bank.account_type* | string | Customer's bank account. Possible value is `saving`(default), `current`, `cc`, `nre`, `nro` | -| nach.form_reference1 | string | A user-entered reference that appears on the NACH form | -| nach.form_reference2 | string | A user-entered reference that appears on the NACH form | -| nach.description | string | All keys listed | +| token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/create-authorization-transaction/#112-create-an-order) are supported | | notes | object | A key-value pair | -All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/create-authorization-transaction/#112-create-an-order) are supported - **Response:** ```json { @@ -601,6 +596,7 @@ client.order.create({ "amount":1000, "currency":"INR", "receipt":"Receipt No. 1", + "payment_capture":True, "notes": { "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." @@ -614,8 +610,10 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | +| 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. | | receipt | string | Your system order reference id. | -| notes | object | A key-value pair | +| notes | array | A key-value pair | + **Response:** ```json { diff --git a/documents/payment.md b/documents/payment.md index b9addc4a..c8e95003 100644 --- a/documents/payment.md +++ b/documents/payment.md @@ -15,7 +15,7 @@ client.payment.capture(paymentId,{ |-----------|---------|--------------------------------------------------------------------------------| | paymentId* | string | Id of the payment to capture | | 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) | +| currency* | string | The currency of the payment (defaults to INR) | **Response:** ```json @@ -70,6 +70,7 @@ client.payment.all(option) | to | timestamp | timestamp before which the payments were created | | count | integer | number of payments to fetch (default: 10) | | skip | integer | number of payments to be skipped (default: 0) | +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `card`, `offers`, `transaction`, `transaction.settlement`, `refunds`, `token` or `emi`| **Response:** ```json @@ -127,6 +128,7 @@ client.payment.fetch(paymentId) | Name | Type | Description | |------------|--------|-----------------------------------| | paymentId* | string | Id of the payment to be retrieved | +| expand[] | string | Used to retrieve additional information about the payment. Possible value is `card`, `offers`, `transaction`, `transaction.settlement`, `refunds`, `token` or `emi`| **Response:** ```json @@ -259,6 +261,7 @@ client.payment.edit(paymentId,{ "wallet": null, "vpa": null, "email": "testme@acme.com", + "customer_id": "cust_JR4BVKjKyJ7enk", "notes": { "key1": "value1", "key2": "value2" @@ -312,16 +315,17 @@ client.payment.fetchCardDetails(paymentId) **Response:** ```json { - "id": "card_6krZ6bcjoeqyV9", + "id": "card_JXPULjlKqC5j0i", "entity": "card", - "name": "Gaurav", - "last4": "3335", + "name": "gaurav", + "last4": "4366", "network": "Visa", - "type": "debit", - "issuer": "SBIN", + "type": "credit", + "issuer": "UTIB", "international": false, - "emi": null, - "sub_type": "business" + "emi": true, + "sub_type": "consumer", + "token_iin": null } ``` ------------------------------------------------------------------------------------------------------- @@ -329,7 +333,7 @@ client.payment.fetchCardDetails(paymentId) ### Fetch Payment Downtime Details ```py -client.payment.fetchPaymentDowntime() +client.payment.fetchDownTime() ``` **Response:**
For payment downtime response please click [here](https://razorpay.com/docs/api/payments/downtime/#fetch-payment-downtime-details) @@ -377,22 +381,27 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | -| payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params | +| payment | object | please refer this [doc](https://razorpay.com/docs/payments/payments/capture-settings/api/) for params | +| notes | object | A key-value pair | **Response:**
```json { - "id": "order_DBJOWzybf0sJbb", + "id": "order_Jng8xOZRVEf97O", "entity": "order", "amount": 50000, "amount_paid": 0, "amount_due": 50000, "currency": "INR", "receipt": "rcptid_11", + "offer_id": "offer_JTUADI4ZWBGWur", + "offers": [ + "offer_JTUADI4ZWBGWur" + ], "status": "created", "attempts": 0, "notes": [], - "created_at": 1566986570 + "created_at": 1656586126 } ``` ------------------------------------------------------------------------------------------------------- @@ -438,6 +447,277 @@ client.payment.createPaymentJson({ ``` ------------------------------------------------------------------------------------------------------- +### Create Payment Json (Third party validation) + +```py +client.payment.createPaymentJson({ + "amount": "500", + "currency": "INR", + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "order_id": "order_GAWN9beXgaqRyO", + "method": "netbanking", + "bank": "HDFC" +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | The currency of the payment (defaults to INR) | +| order_id* | string | The unique identifier of the order created. | +| email* | string | Email of the customer | +| contact* | string | Contact number of the customer | +| method* | string | Possible value is `netbanking` | +| bank* | string | The customer's bank code.For example, `HDFC`.| + + please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/netbanking#step-3-create-a-payment) for params + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_GAWOYqPlvrtPSi", + "next": [ + { + "action": "redirect", + "url": "https://api.razorpay.com/v1/payments/pay_GAWOYqPlvrtPSi/authorize" + } + ] +} +``` +------------------------------------------------------------------------------------------------------- +### Create Payment UPI s2s / VPA token (Third party validation) + +```py +client.payment.createUpi({ + "amount": 200, + "currency": "INR", + "order_id": "order_GAWRjlWkVcRh0V", + "email": "gaurav.kumar@example.com", + "contact": "9123456789", + "method": "upi", + "customer_id": "cust_EIW4T2etiweBmG", + "save": 1, + "ip": "192.168.0.103", + "referer": "http", + "user_agent": "Mozilla/5.0", + "description": "Test flow", + "notes": { + "note_key": "value1" + }, + "upi": { + "flow": "collect", + "vpa": "gauravkumar@exampleupi", + "expiry_time": 5 + } +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | The currency of the payment (defaults to INR) | +| order_id* | string | The unique identifier of the order created. | +| email* | string | Email of the customer | +| customer_id* | string | The id of the customer to be fetched | +| contact* | string | Contact number of the customer | +| notes | array | A key-value pair | +| description | string | Descriptive text of the payment. | +| save | boolean | Specifies if the VPA should be stored as tokens.Possible value is `0`, `1` | +| callback_url | string | URL where Razorpay will submit the final payment status. | +| ip* | string | The client's browser IP address. For example `117.217.74.98` | +| referer* | string | Value of `referer` header passed by the client's browser. For example, `https://example.com/` | +| user_agent* | string | Value of `user_agent` header passed by the client's browser. For example, `Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36` | +| upi* (for Upi only) | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect#step-14-initiate-a-payment) are supported | + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_EAm09NKReXi2e0" +} +``` +------------------------------------------------------------------------------------------------------- +### Create Payment UPI s2s / VPA token (Third party validation) + +```py +client.payment.createUpi({ + "amount": 100, + "currency": "INR", + "order_id": "order_Ee0biRtLOqzRjP", + "email": "gaurav.kumar@example.com", + "contact": "9090909090", + "method": "upi", + "ip": "192.168.0.103", + "referer": "http", + "user_agent": "Mozilla/5.0", + "description": "Test flow", + "notes": { + "purpose": "UPI test payment" + }, + "upi": { + "flow" : "intent" + } +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| amount* | integer | Amount of the order to be paid | +| currency* | string | The currency of the payment (defaults to INR) | +| order_id* | string | The unique identifier of the order created. | +| email* | string | Email of the customer | +| customer_id* | string | The id of the customer to be fetched | +| contact* | string | Contact number of the customer | +| notes | array | A key-value pair | +| description | string | Descriptive text of the payment. | +| save | boolean | Specifies if the VPA should be stored as tokens.Possible value is `0`, `1` | +| callback_url | string | URL where Razorpay will submit the final payment status. | +| ip* | string | The client's browser IP address. For example `117.217.74.98` | +| referer* | string | Value of `referer` header passed by the client's browser. For example, `https://example.com/` | +| user_agent* | string | Value of `user_agent` header passed by the client's browser. For example, `Mozilla/5.0 (Windows NT 6.1) AppleWebKit/537.36 (KHTML, like Gecko) Chrome/79.0.3945.130 Safari/537.36` | +| upi* (for Upi only) | array | All keys listed [here](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/intent/#step-2-initiate-a-payment) are supported | + +**Response:**
+```json +{ + "razorpay_payment_id": "pay_CMeM6XvOPGFiF", + "link": "upi://pay?pa=success@razorpay&pn=xyz&tr=xxxxxxxxxxx&tn=gourav&am=1&cu=INR&mc=xyzw" +} +------------------------------------------------------------------------------------------------------- +### OTP Generate + +```py +client.payment.otpGenerate(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | + +Doc reference [doc](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/json/v2/build-integration/cards/#otp-generation-) + +**Response:**
+ +```json +{ + "razorpay_payment_id": "pay_FVmAstJWfsD3SO", + "next": [ + { + "action": "otp_submit", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=" + }, + { + "action": "otp_resend", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=" + } + ], + "metadata": { + "issuer": "HDFC", + "network": "MC", + "last4": "1111", + "iin": "411111" + } +} +``` +------------------------------------------------------------------------------------------------------- + +### OTP Submit + +```py +client.payment.otpSubmit(paymentId,{ + "otp": "12345" + }) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | +| otp* | string | The customer receives the OTP using their preferred notification medium - SMS or email | + +Doc reference [doc](https://razorpay.com/docs/payments/payment-gateway/s2s-integration/json/v2/build-integration/cards/#response-on-submitting-otp) + +**Response:**
+Success +```json +{ + "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3", + "razorpay_order_id": "order_9A33XWu170gUtm", + "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} +``` +------------------------------------------------------------------------------------------------------- + +### Valid VPA (Third party validation) + +```py +client.payment.validateVpa({ + "vpa": "gauravkumar@exampleupi" +}) +``` + +**Parameters:** +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| vpa* | string | The virtual payment address (VPA) you want to validate. For example, `gauravkumar@exampleupi` | + + please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect#step-13-validate-the-vpa) for params + +**Response:**
+```json +{ + "vpa": "gauravkumar@exampleupi", + "success": true, + "customer_name": "Gaurav Kumar" +} +``` +------------------------------------------------------------------------------------------------------- + +### Fetch payment methods (Third party validation) + +```py +client = razorpay.Client(auth=("key", "")) // Use Only razorpay key +client.payment.fetchPaymentMethods() +``` + +**Response:**
+ please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/methods-api/#fetch-payment-methods) for response + +``` +======= +### OTP Resend + +```py +client.payment.otpResend(paymentId) +``` + +**Parameters:** + +| Name | Type | Description | +|-------------|---------|--------------------------------------| +| paymentId* | integer | Unique identifier of the payment | + +Doc reference [doc](https://razorpay.com/docs/payments/payment-methods/cards/authentication/native-otp/#otp-resend) + +**Response:**
+ +```json +{ + "next": [ + "otp_submit", + "otp_resend" + ], + "razorpay_payment_id": "pay_JWaNvYmrx75sXo" +} +``` +------------------------------------------------------------------------------------------------------- + **PN: * indicates mandatory fields**

diff --git a/documents/paymentLink.md b/documents/paymentLink.md index afa6e3d7..2360664a 100644 --- a/documents/paymentLink.md +++ b/documents/paymentLink.md @@ -9,7 +9,7 @@ Standard Payment Link client.payment_link.create({ "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -18,10 +18,10 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "notes": { "policy_name": "Jeevan Bima" }, @@ -35,25 +35,29 @@ UPI Payment Link ```py client.payment_link.create({ - "upi_link": true, + "upi_link": True, "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, - "description": "For XYZ purpose", + "expire_by": 1691097057, + "reference_id": "TS1989", + "description": "Payment for policy no #23456", "customer": { "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "notes": { "policy_name": "Jeevan Bima" } + "callback_url": "https://example-callback-url.com/", + "callback_method": "get" }) ``` @@ -64,12 +68,17 @@ client.payment_link.create({ |upi_link* | boolean | boolean Must be set to true // to creating UPI Payment Link only | |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | +|accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values: true - Customer can make partial payments. false (default) - Customer cannot make partial payments. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | -|reference_id | string | AReference number tagged to a Payment Link. | -|customer | object | name, email, contact | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | +|reference_id | string | Reference number tagged to a Payment Link. | +|customer | object | All parameters listed [here](https://razorpay.com/docs/api/payments/payment-links/#sample-codes-for-upi-payment-links) are supported | |expire_by | integer | Timestamp, in Unix, at which the Payment Link will expire. By default, a Payment Link will be valid for six months from the date of creation. | |notify | object | sms or email (boolean) | |notes | json object | Key-value pair that can be used to store additional information about the entity. Maximum 15 key-value pairs, 256 characters (maximum) each. For example, "note_key": "Beam me up Scotty” | +| callback_url | string | If specified, adds a redirect URL to the Payment Link. Once customers completes the payment, they are redirected to the specified URL. | +| callback_method | string | If callback_url parameter is passed, callback_method must be passed with the value `get`. | +| reminder_enable | boolean | Used to send reminders for the Payment Link. Possible values is `true` or `false` | **Response:** For create payment link response please click [here](https://razorpay.com/docs/api/payment-links/#create-payment-link) @@ -114,10 +123,10 @@ For fetch specific payment link response please click [here](https://razorpay.co ### Update payment link ```py -client.payment_link.edit({ +client.payment_link.edit(paymentLinkId, { "reference_id": "TS35", "expire_by": 1653347540, - "reminder_enable":false, + "reminder_enable":False, "notes":{ "policy_name": "Jeevan Saral" } @@ -180,35 +189,38 @@ client.payment_link.notifyBy(paymentLinkId, medium) ```py client.payment_link.create({ - "amount": 20000, + "amount": 1500, "currency": "INR", - "accept_partial": false, - "description": "For XYZ purpose", + "accept_partial": False, + "reference_id": "#aasasw8", + "description": "Payment for policy no #23456", "customer": { "name": "Gaurav Kumar", - "email": "gaurav.kumar@example.com", - "contact": "+919999999999" + "contact": "+919999999999", + "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { - "order": [ - { - "account": "acc_CNo3jSI8OkFJJJ", - "amount": 500, - "currency": "INR", - "notes": { - "branch": "Acme Corp Bangalore North", - "name": "Saurav Kumar", + "order": { + "transfers": [ + { + "account": "acc_I0QRP7PpvaHhpB", + "amount": 500, + "currency": "INR", + "notes": { + "branch": "Acme Corp Bangalore North", + "name": "Bhairav Kumar" + }, "linked_account_notes": [ "branch" ] } - } - ] + ] + } } }) ``` @@ -267,7 +279,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 3400, "currency": "INR", - "accept_partial": false, + "accept_partial": False, "reference_id": "#425", "description": "Payment for policy no #23456", "customer": { @@ -276,10 +288,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": false, + "reminder_enable": False, "options": { "order": { "offers": [ @@ -345,7 +357,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#425", "description": "Payment for policy no #23456", @@ -355,10 +367,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": false + "reminder_enable": False }) ``` @@ -440,7 +452,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -449,10 +461,10 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "partial_payment": { @@ -527,7 +539,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#2234542", "description": "Payment for policy no #23456", @@ -537,10 +549,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "name": "Lacme Corp" @@ -556,7 +568,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -609,7 +621,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#417", "description": "Payment for policy no #23456", @@ -619,10 +631,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "prefill": { @@ -644,7 +656,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -662,7 +674,7 @@ For prefill checkout fields response please click [here](https://razorpay.com/do client.payment_link.create({ "amount": 500, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "description": "For XYZ purpose", "customer": { @@ -671,10 +683,10 @@ client.payment_link.create({ "contact": "+919999999999" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "method": { @@ -695,7 +707,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -749,7 +761,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#20", "description": "Payment for policy no #23456", @@ -759,10 +771,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "readonly": { @@ -781,7 +793,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -835,7 +847,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#423212", "description": "Payment for policy no #23456", @@ -845,14 +857,14 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "theme": { - "hide_topbar": true + "hide_topbar": True } } } @@ -866,7 +878,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | @@ -919,7 +931,7 @@ client.payment_link.create({ client.payment_link.create({ "amount": 1000, "currency": "INR", - "accept_partial": true, + "accept_partial": True, "first_min_partial_amount": 100, "reference_id": "#421", "description": "Payment for policy no #23456", @@ -929,10 +941,10 @@ client.payment_link.create({ "email": "gaurav.kumar@example.com" }, "notify": { - "sms": true, - "email": true + "sms": True, + "email": True }, - "reminder_enable": true, + "reminder_enable": True, "options": { "checkout": { "partial_payment": { @@ -953,7 +965,7 @@ client.payment_link.create({ |amount* | integer | Amount to be paid using the Payment Link. | |currency | string | A three-letter ISO code for the currency in which you want to accept the payment. For example, INR. | |accept_partial | boolean | Indicates whether customers can make partial payments using the Payment Link. Possible values:true - Customer can make partial payments.false (default) - Customer cannot make partial payments. | -|first_min_partial_amount | integer | | +|first_min_partial_amount | integer |Minimum amount, in currency subunits, that must be paid by the customer as the first partial payment. // UPI Payment Link is not supported partial payment | |description | string | A brief description of the Payment Link | |customer | object | name, email, contact | |notify | object | sms or email (boolean) | diff --git a/documents/qrcode.md b/documents/qrcode.md index 7ef09181..84074f84 100644 --- a/documents/qrcode.md +++ b/documents/qrcode.md @@ -7,7 +7,7 @@ client.qrcode.create({ "type": "upi_qr", "name": "Store_1", "usage": "single_use", - "fixed_amount": true, + "fixed_amount": True, "payment_amount": 300, "description": "For Store 1", "customer_id": "cust_HKsR5se84c5LTO", @@ -240,24 +240,27 @@ client.qrcode.fetch(qrCodeId) "count": 1, "items": [ { - "id": "qr_HMsgvioW64f0vh", + "id": "qr_HO2r1MDprYtWRT", "entity": "qr_code", - "created_at": 1623660959, + "created_at": 1623915088, "name": "Store_1", "usage": "single_use", "type": "upi_qr", - "image_url": "https://rzp.io/i/DTa2eQR", + "image_url": "https://rzp.io/i/oCswTOcCo", "payment_amount": 300, - "status": "active", + "status": "closed", "description": "For Store 1", "fixed_amount": true, - "payments_amount_received": 0, - "payments_count_received": 0, + "payments_amount_received": 300, + "payments_count_received": 1, "notes": { "purpose": "Test UPI QR code notes" }, "customer_id": "cust_HKsR5se84c5LTO", - "close_by": 1681615838 + "close_by": 1681615838, + "closed_at": 1625558914, + "close_reason": "paid", + "tax_invoice": null } ] } @@ -299,7 +302,8 @@ client.qrcode.fetch(qrCodeId) "notes": [], "customer_id": "cust_HKsR5se84c5LTO", "close_by": 1624472999, - "close_reason": null + "close_reason": "paid", + "tax_invoice": null } ] } @@ -370,7 +374,7 @@ client.qrcode.fetch_all_payments(qrCodeId, options) ### Close a QR Code ```py -client.qrcode.close(qrCodeId); +client.qrcode.close(qrCodeId) ``` **Parameters:** @@ -406,6 +410,48 @@ client.qrcode.close(qrCodeId); ``` ------------------------------------------------------------------------------------------------------- +### Refund a Payment + +```py +client.payment.refund("pay_JRP3Y66cNcf2qF",{ + "amount": "100", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + } +}) +``` + +**Parameters:** + +| Name | Type | Description | +|-----------------|---------|------------------------------------------------------------------------------| +| paymentId* | string | The id of the payment to be refunded | +| amount | string | Amount to be refunded | +| notes | array | Key-value pair that can be used to store additional information about the QR code. Maximum 15 key-value pairs, 256 characters (maximum) each. | + +**Response:** +```json +{ + "id": "rfnd_FP8QHiV938haTz", + "entity": "refund", + "amount": 500100, + "receipt": "Receipt No. 31", + "currency": "INR", + "payment_id": "pay_29QQoUBi66xm2f", + "notes": [], + "receipt": null, + "acquirer_data": { + "arn": null + }, + "created_at": 1597078866, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" +} +``` +------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields**
diff --git a/documents/refund.md b/documents/refund.md index debdecf6..9914e0af 100644 --- a/documents/refund.md +++ b/documents/refund.md @@ -10,7 +10,7 @@ client.payment.refund(paymentId,{ "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" }, - "receipt": "Receipt No. 31" + "receipt": "#Receipt No. 131" }) ``` @@ -27,20 +27,24 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_FP8QHiV938haTz", + "id": "rfnd_JnzyQwYOOBNJJu", "entity": "refund", - "amount": 500100, - "receipt": "Receipt No. 31", + "amount": 100, "currency": "INR", - "payment_id": "pay_FCXKPFtYfPXJPy", - "notes": [], + "payment_id": "pay_JRSS9bMrRMds3w", + "notes": { + "notes_key_1": "Beam me up Scotty.", + "notes_key_2": "Engage" + }, + "receipt": "#Receipt No. 131", "acquirer_data": { "arn": null }, - "created_at": 1597078866, + "created_at": 1656655960, "batch_id": null, "status": "processed", - "speed_processed": "normal" + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -51,7 +55,7 @@ client.payment.refund(paymentId,{ client.payment.refund(paymentId,{ "amount": "100", "speed": "optimum", - "receipt": "Receipt No. 31" + "receipt": "#Receipt No. 132" }) ``` @@ -67,22 +71,20 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_FP8R8EGjGbPkVb", + "id": "rfnd_Jo00DtIBzADMi6", "entity": "refund", - "amount": 500100, + "amount": 100, "currency": "INR", - "payment_id": "pay_FC8MmhMBZPKDHF", - "notes": { - "notes_key_1": "Tea, Earl Grey, Hot", - "notes_key_2": "Tea, Earl Grey… decaf." - }, - "receipt": "Receipt No. 31", + "payment_id": "pay_JRP3Y66cNcf2qF", + "notes": [], + "receipt": "#Receipt No. 132", "acquirer_data": { "arn": null }, - "created_at": 1597078914, + "created_at": 1656656062, "batch_id": null, - "status": "processed", + "status": "pending", + "speed_processed": "instant", "speed_requested": "optimum" } ``` @@ -99,10 +101,10 @@ client.payment.fetch_multiple_refund(paymentId,option) | Name | Type | Description | |-------|-----------|--------------------------------------------------| | paymentId* | string | The id of the payment | -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | timestamp after which the refunds were created | +| to | timestamp | timestamp before which the refunds were created | +| count | integer | number of refunds to fetch (default: 10) | +| skip | integer | number of refunds to be skipped (default: 0) | **Refund:** ```json @@ -179,10 +181,10 @@ client.refund.all(options) | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | timestamp after which the refunds were created | +| to | timestamp | timestamp before which the refunds were created | +| count | integer | number of refunds to fetch (default: 10) | +| skip | integer | number of refunds to be skipped (default: 0) | **Response:** ```json @@ -249,7 +251,7 @@ client.refund.fetch(refundId) ### Update the refund ```py -client.refund.edit({ +client.refund.edit(refundId,{ "notes": { "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" diff --git a/documents/registerEmandate.md b/documents/registerEmandate.md index 7619367c..7643841b 100644 --- a/documents/registerEmandate.md +++ b/documents/registerEmandate.md @@ -57,6 +57,7 @@ client.order.create({ "notes_key_2": "Engage" }, "token": { + "first_payment_amount": 100, "auth_type": "netbanking", "max_amount": 9999900, "expire_at": 4102444799, @@ -112,6 +113,7 @@ client.registration_link.create({ "currency": "INR", "description": "12 p.m. Meals", "subscription_registration": { + "first_payment_amount": 100, "method": "emandate", "auth_type": "netbanking", "expire_at": 1580480689, @@ -138,12 +140,12 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|---------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | +| customer | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#12-using-a-registration-link) are supported | | type* | object | the value is `link`. | | 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) | | description* | string | A brief description of the payment. | -| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#121-create-a-registration-link) are supported | +| subscription_registration | object | All keys listed [here](https://razorpay.com/docs/api/recurring-payments/emandate/auto-debit/#12-using-a-registration-link) are supported | | receipt | string | Your system order reference id. | | 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.| | sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | @@ -162,6 +164,7 @@ For create registration link response please click [here](https://razorpay.com/d client.order.create({ "amount":1000, "currency":"INR", + "payment_capture": True, "receipt":"Receipt No. 1", "notes": { "notes_key_1":"Tea, Earl Grey, Hot", @@ -175,6 +178,7 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | 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) | +| 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. | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | @@ -205,14 +209,17 @@ client.order.create({ ```py client.payment.createRecurring({ "email": "gaurav.kumar@example.com", - "contact": 9123456789, + "contact": "9123456789", "amount": 1000, "currency": "INR", - "recurring": 1, + "order_id": "order_1Aa00000000002", + "customer_id": "cust_1Aa00000000001", + "token": "token_1Aa00000000001", + "recurring": "1", "description": "Creating recurring payment for Gaurav Kumar", "notes": { - "key1": "value3", - "key2": "value2" + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." } }) ``` @@ -234,9 +241,7 @@ client.payment.createRecurring({ **Response:** ```json { - "razorpay_payment_id" : "pay_1Aa00000000001", - "razorpay_order_id" : "order_1Aa00000000001", - "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" + "razorpay_payment_id" : "pay_1Aa00000000001" } ``` ------------------------------------------------------------------------------------------------------- diff --git a/documents/registerNach.md b/documents/registerNach.md index e197d10c..f1d74c57 100644 --- a/documents/registerNach.md +++ b/documents/registerNach.md @@ -47,9 +47,10 @@ client.customer.create({ ```py client.order.create({ - "amount": 100, + "amount": 0, "currency": "INR", "method": "nach", + "customer_id": "cust_1Aa00000000001", "receipt": "Receipt No. 5", "notes": { "note_key 1"": "Beam me up Scotty", @@ -87,19 +88,9 @@ client.order.create({ | 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 `nach`. | +| token | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/paper-nach/auto-debit/#112-create-an-order) are supported | +| notes | array | A key-value pair | | receipt | string | Your system order reference id. | -| token.auth_type* | string | Possible value is `physical`| -| token.max_amount | integer | Use to set the maximum amount per debit request. The value can range from `500` - `1000000000` (1cr, default value) | -| token.expire_at | integer | The timestamp, in Unix format, till when the registration link should expire | -| token.notes | object | A key-value pair | -| bank.account_number* | string | Customer's bank account number. | -| bank.ifsc_code* | string | Customer's bank IFSC | -| bank.beneficiary_name* | string | Customer's name | -| bank.account_type* | string | Customer's bank account. Possible value is `saving`(default), `current`, `cc`, `nre`, `nro` | -| nach.form_reference1 | string | A user-entered reference that appears on the NACH form | -| nach.form_reference2 | string | A user-entered reference that appears on the NACH form | -| nach.description | string | All keys listed | -| notes | object | A key-value pair | **Response:** ```json @@ -334,7 +325,7 @@ client.order.create({ |-----------------|---------|------------------------------------------------------------------------------| | 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) | -| 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. | +| 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. | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | @@ -368,11 +359,14 @@ client.payment.createRecurring({ "contact": "9123456789", "amount": 1000, "currency": "INR", + "order_id": "order_1Aa00000000002", + "customer_id": "cust_1Aa00000000001", + "token": "token_1Aa00000000001", "recurring": "1", "description": "Creating recurring payment for Gaurav Kumar", "notes": { - "key1": "value3", - "key2": "value2" + "note_key 1": "Beam me up Scotty", + "note_key 2": "Tea. Earl Gray. Hot." } }) ``` @@ -389,14 +383,12 @@ client.payment.createRecurring({ | tokenId* | string | The id of the token to be fetched | | recurring* | boolean | Possible values is `0` or `1` | | description | string | A brief description of the payment. | -| notes | object | A key-value pair | +| notes | array | A key-value pair | **Response:** ```json { - "razorpay_payment_id" : "pay_1Aa00000000001", - "razorpay_order_id" : "order_1Aa00000000001", - "razorpay_signature" : "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" + "razorpay_payment_id" : "pay_1Aa00000000001" } ``` ------------------------------------------------------------------------------------------------------- diff --git a/documents/settlement.md b/documents/settlement.md index 693f8a15..68084322 100644 --- a/documents/settlement.md +++ b/documents/settlement.md @@ -65,154 +65,13 @@ client.settlement.fetch(settlementId) ``` ------------------------------------------------------------------------------------------------------- -### Settlement report for a month - -```py -client.settlement.report({ - year: 2020, - month: 9 -}) -``` - -**Parameters:** - -| Name | Type | Description | -|---------------|-------------|---------------------------------------------| -| 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) | - -**Response:** -```json -{ - "entity": "collection", - "count": 4, - "items": [ - { - "entity_id": "pay_DEXrnipqTmWVGE", - "type": "payment", - "debit": 0, - "credit": 97100, - "amount": 100000, - "currency": "INR", - "fee": 2900, - "tax": 0, - "on_hold": false, - "settled": true, - "created_at": 1567692556, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "credit_type": "default", - "description": "Recurring Payment via Subscription", - "notes": "{}", - "payment_id": null, - "settlement_utr": "1568176960vxp0rj", - "order_id": "order_DEXrnRiR3SNDHA", - "order_receipt": null, - "method": "card", - "card_network": "MasterCard", - "card_issuer": "KARB", - "card_type": "credit", - "dispute_id": null - }, - { - "entity_id": "rfnd_DGRcGzZSLyEdg1", - "type": "refund", - "debit": 242500, - "credit": 0, - "amount": 242500, - "currency": "INR", - "fee": 0, - "tax": 0, - "on_hold": false, - "settled": true, - "created_at": 1568107224, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "credit_type": "default", - "description": null, - "notes": "{}", - "payment_id": "pay_DEXq1pACSqFxtS", - "settlement_utr": "1568176960vxp0rj", - "order_id": "order_DEXpmZgffXNvuI", - "order_receipt": null, - "method": "card", - "card_network": "MasterCard", - "card_issuer": "KARB", - "card_type": "credit", - "dispute_id": null - }, - { - "entity_id": "trf_DEUoCEtdsJgvl7", - "type": "transfer", - "debit": 100296, - "credit": 0, - "amount": 100000, - "currency": "INR", - "fee": 296, - "tax": 46, - "on_hold": false, - "settled": true, - "created_at": 1567681786, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "credit_type": "default", - "description": null, - "notes": null, - "payment_id": "pay_DEApNNTR6xmqJy", - "settlement_utr": "1568176960vxp0rj", - "order_id": null, - "order_receipt": null, - "method": null, - "card_network": null, - "card_issuer": null, - "card_type": null, - "dispute_id": null - }, - { - "entity_id": "adj_EhcHONhX4ChgNC", - "type": "adjustment", - "debit": 0, - "credit": 1012, - "amount": 1012, - "currency": "INR", - "fee": 0, - "tax": 0, - "on_hold": false, - "settled": true, - "created_at": 1567681786, - "settled_at": 1568176960, - "settlement_id": "setl_DGlQ1Rj8os78Ec", - "posted_at": null, - "description": "test reason", - "notes": null, - "payment_id": null, - "settlement_utr": null, - "order_id": null, - "order_receipt": null, - "method": null, - "card_network": null, - "card_issuer": null, - "card_type": null, - "dispute_id": null - } - ] -} -``` -------------------------------------------------------------------------------------------------------- - ### Settlement recon ```py client.settlement.report({ - year: 2020, - month: 9, - day:11 + "year": 2020, + "month": 9, + "day":11 }) ``` **Parameters:** @@ -222,6 +81,8 @@ client.settlement.report({ | 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 day the settlement was received in the `DD` format. For example, | +| count | integer | Specifies the number of available settlements to be fetched. | +| skip | integer | Specifies the number of available settlements to be skipped when fetching a count. | **Response:** ```json @@ -350,7 +211,7 @@ client.settlement.report({ ```py client.settlement.create_ondemand_settlement({ "amount": 1221, - "settle_full_balance": 0, + "settle_full_balance": false, "description": "Testing", "notes": { "notes_key_1": "Tea, Earl Grey, Hot", @@ -410,6 +271,9 @@ client.settlement.create_ondemand_settlement({ } } ``` + +Create on-demand settlement please click [here](https://razorpay.com/docs/api/settlements/instant/#create-an-instant-settlement) + ------------------------------------------------------------------------------------------------------- ### Fetch all on-demand settlements @@ -421,13 +285,59 @@ client.settlement.fetch_all_ondemand_settlement(options) | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | timestamp after which the settlements were created | +| to | timestamp | timestamp before which the settlements were created | +| count | integer | number of settlements to fetch (default: 10) | +| skip | integer | number of settlements to be skipped (default: 0) | **Response:**
-For all on-demand settlements response please click [here](https://razorpay.com/docs/api/settlements/#fetch-all-on-demand-settlements) + +```json +{ + "entity": "collection", + "count": 2, + "items": [ + { + "id": "setlod_FNj7g2YS5J67Rz", + "entity": "settlement.ondemand", + "amount_requested": 200000, + "amount_settled": 199410, + "amount_pending": 0, + "amount_reversed": 0, + "fees": 590, + "tax": 90, + "currency": "INR", + "settle_full_balance": false, + "status": "processed", + "description": "Need this to make vendor payments.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1596771429 + }, + { + "id": "setlod_FJOp0jOWlalIvt", + "entity": "settlement.ondemand", + "amount_requested": 300000, + "amount_settled": 299114, + "amount_pending": 0, + "amount_reversed": 0, + "fees": 886, + "tax": 136, + "currency": "INR", + "settle_full_balance": false, + "status": "processed", + "description": "Need this to buy stock.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1595826576 + } + ] +} +``` ------------------------------------------------------------------------------------------------------- @@ -444,8 +354,28 @@ client.settlement.fetch_ondemand_settlement_id(settlementId) | settlementId* | string | Settlement Id of the On-demand settlement| **Response:** -For on-demand settlement by ID response please click [here](https://razorpay.com/docs/api/settlements/#fetch-on-demand-settlements-by-id) +```json +{ + "id": "setlod_FNj7g2YS5J67Rz", + "entity": "settlement.ondemand", + "amount_requested": 200000, + "amount_settled": 199410, + "amount_pending": 0, + "amount_reversed": 0, + "fees": 590, + "tax": 90, + "currency": "INR", + "settle_full_balance": false, + "status": "processed", + "description": "Need this to make vendor payments.", + "notes": { + "notes_key_1": "Tea, Earl Grey, Hot", + "notes_key_2": "Tea, Earl Grey… decaf." + }, + "created_at": 1596771429 +} +``` ------------------------------------------------------------------------------------------------------- **PN: * indicates mandatory fields** diff --git a/documents/subscription.md b/documents/subscription.md index 7c26f15c..cd41069c 100644 --- a/documents/subscription.md +++ b/documents/subscription.md @@ -32,11 +32,12 @@ client.subscription.create({ | plan_id* | string | The unique identifier for a plan that should be linked to the subscription.| | total_count* | string | The number of billing cycles for which the customer should be charged | | customer_notify | boolean | Indicates whether the communication to the customer would be handled by you or us | -| quantity | integer | The number of times the customer should be charged the plan amount per invoice | +| quantity | integer | The number of times the customer should be charged the plan amount per invoice | | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | -| addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. | -| notes | object | Notes you can enter for the contact for future reference. | +| addons | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-a-subscription) are supported | +| notes | array | Notes you can enter for the contact for future reference. | +| offer_id | string | The unique identifier of the offer that is linked to the subscription. | **Response:** ```json @@ -111,9 +112,10 @@ client.subscription.create({ | quantity | integer | The number of times the customer should be charged the plan amount per invoice | | start_at | integer | The timestamp, in Unix format, for when the subscription should start. If not passed, the subscription starts immediately after the authorization payment. | | expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | -| addons | object | Object that contains details of any upfront amount you want to collect as part of the authorization transaction. | -| notes | object | Notes you can enter for the contact for future reference. | -| notify_info | object | The customer's email and phone number to which notifications are to be sent. (PN: Use this object only if you have set the `customer_notify` parameter to 1. That is, Razorpay sends notifications to the customer.) | +| addons | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-a-subscription-link) are supported | +| notes | array | Notes you can enter for the contact for future reference. | +| notify_info | array | All parameters listed [here](https://razorpay.com/docs/api/payments/subscriptions/#create-a-subscription-link) are supported | +| offer_id | string | The unique identifier of the offer that is linked to the subscription. | **Response:** ```json diff --git a/documents/token.md b/documents/token.md index 25aa91e9..2e4e1704 100644 --- a/documents/token.md +++ b/documents/token.md @@ -70,47 +70,50 @@ client.token.all(customerId) **Response:** ```json { - "entity":"collection", - "count":1, - "items":[ - { - "id":"token_HouA2OQR5Z2jTL", - "entity":"token", - "token":"2JPRk664pZHUWG", - "bank":null, - "wallet":null, - "method":"card", - "card":{ - "entity":"card", - "name":"Gaurav Kumar", - "last4":"8950", - "network":"Visa", - "type":"credit", - "issuer":"STCB", - "international":false, - "emi":false, - "sub_type":"consumer", - "expiry_month":12, - "expiry_year":2021, - "flows":{ - "otp":true, - "recurring":true - } - }, - "recurring":true, - "recurring_details":{ - "status":"confirmed", - "failure_reason":null - }, - "auth_type":null, - "mrn":null, - "used_at":1629779657, - "created_at":1629779657, - "expired_at":1640975399, - "dcc_enabled":false, - "billing_address":null - } - ] + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_JIskPHR6HnypUV", + "entity": "token", + "token": "14LDXyJ1q4MKge", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "ankit", + "last4": "4366", + "network": "Visa", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": null, + "expiry_month": 12, + "expiry_year": 2022, + "flows": { + "otp": true, + "recurring": true + } + }, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": null, + "mrn": null, + "used_at": 1649861969, + "created_at": 1649861969, + "expired_at": 1672511399, + "status": null, + "notes": [], + "dcc_enabled": false, + "compliant_with_tokenisation_guidelines": false + } + ] } ``` ------------------------------------------------------------------------------------------------------- @@ -130,35 +133,44 @@ client.token.fetch(customerId, tokenId) **Response:** ```json { - "id": "token_Hxe0skTXLeg9pF", - "entity": "token", - "token": "F85BgXnGVwcuqV", - "bank": null, - "wallet": null, - "method": "card", - "card": { - "entity": "card", - "name": "ankit", - "last4": "5449", - "network": "MasterCard", - "type": "credit", - "issuer": "UTIB", - "international": false, - "emi": false, - "sub_type": "consumer", - "expiry_month": 12, - "expiry_year": 2024, - "flows": { - "recurring": true - } - }, - "recurring": true, - "auth_type": null, - "mrn": null, - "used_at": 1632976165, - "created_at": 1631687852, - "expired_at": 1634215992, - "dcc_enabled": false + "id": "token_JIskPHR6HnypUV", + "entity": "token", + "token": "14LDXyJ1q4MKge", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "ankit", + "last4": "4366", + "network": "Visa", + "type": "credit", + "issuer": "UTIB", + "international": false, + "emi": true, + "sub_type": "consumer", + "token_iin": null, + "expiry_month": 12, + "expiry_year": 2022, + "flows": { + "otp": true, + "recurring": true + } + }, + "recurring": true, + "recurring_details": { + "status": "confirmed", + "failure_reason": null + }, + "auth_type": null, + "mrn": null, + "used_at": 1649861969, + "created_at": 1649861969, + "expired_at": 1672511399, + "status": null, + "notes": [], + "dcc_enabled": false, + "compliant_with_tokenisation_guidelines": false } ``` ------------------------------------------------------------------------------------------------------- @@ -184,7 +196,64 @@ client.token.delete(customerId, tokenId) ``` ------------------------------------------------------------------------------------------------------- +### Fetch VPA tokens of a customer id + +```js +client.token.all(customerId) +``` + +**Parameters:** + +| Name | Type | Description | +|---------------|-------------|---------------------------------------------| +| customerId* | string | The id of the customer to be fetched | + + please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/upi/collect/#step-22-fetch-vpa-tokens-of-a-customer) + +**Response:** +```json +{ + "entity": "collection", + "count": 1, + "items": [ + { + "id": "token_EeroOjvOvorT5L", + "entity": "token", + "token": "4ydxm47GQjrIEx", + "bank": null, + "wallet": null, + "method": "card", + "card": { + "entity": "card", + "name": "Gaurav Kumar", + "last4": "8430", + "network": "Visa", + "type": "credit", + "issuer": "HDFC", + "international": false, + "emi": true, + "expiry_month": 12, + "expiry_year": 2022, + "flows": { + "otp": true, + "recurring": true + } + }, + "vpa": null, + "recurring": false, + "auth_type": null, + "mrn": null, + "used_at": 1586976724, + "created_at": 1586976724, + "expired_at": 1672511399, + "dcc_enabled": false + } + ] +} +``` +------------------------------------------------------------------------------------------------------- + **PN: * indicates mandatory fields**

-**For reference click [here](https://razorpay.com/docs/api/recurring-payments/upi/tokens/)** \ No newline at end of file +**For reference click [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/tokens/)** \ No newline at end of file diff --git a/documents/transfer.md b/documents/transfer.md index 0a2c13b9..f547b46a 100644 --- a/documents/transfer.md +++ b/documents/transfer.md @@ -185,22 +185,33 @@ client.transfer.create({ **Response:** ```json { - "id": "trf_E9utgtfGTcpcmm", + "id": "trf_JnRRvcSbZb1VHN", "entity": "transfer", - "source": "acc_CJoeHMNpi0nC7k", - "recipient": "acc_CPRsN1LkFccllA", - "amount": 100, + "status": "processed", + "source": "acc_HZbJUcl6DBDLIN", + "recipient": "acc_HjVXbtpSCIxENR", + "amount": 500, "currency": "INR", "amount_reversed": 0, - "notes": [], "fees": 1, "tax": 0, + "notes": [], + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, "recipient_settlement_id": null, - "created_at": 1580219046, - "linked_account_notes": [], - "processed_at": 1580219046 + "created_at": 1656534379, + "processed_at": 1656534379, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_JnRRvcSbZb1VHN", + "source": null, + "metadata": null + } } ``` ------------------------------------------------------------------------------------------------------- @@ -224,22 +235,34 @@ client.payment.transfers(paymentId) "count": 1, "items": [ { - "id": "trf_EAznuJ9cDLnF7Y", + "id": "trf_I8kA5qRv9czK3Y", "entity": "transfer", - "source": "pay_E9up5WhIfMYnKW", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 1000, + "status": "processed", + "source": "pay_I7watngocuEY4P", + "recipient": "acc_HjVXbtpSCIxENR", + "amount": 10000, "currency": "INR", - "amount_reversed": 100, + "amount_reversed": 0, + "fees": 12, + "tax": 2, "notes": [], - "fees": 3, - "tax": 0, + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, + "settlement_status": "pending", "recipient_settlement_id": null, - "created_at": 1580454666, - "linked_account_notes": [], - "processed_at": 1580454666 + "created_at": 1634111246, + "processed_at": 1634111251, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_I8kA5qRv9czK3Y", + "source": null, + "metadata": null + } } ] } @@ -259,54 +282,62 @@ client.order.fetch(orderId, { | Name | Type | Description | |---------------|-------------|---------------------------------------------| | orderId* | string | The id of the order to be fetched | -| expand* | string | Supported value is `transfer` | +| expand[]* | string | Supported value is `transfer` | **Response:** ```json { - "id": "order_DSkl2lBNvueOly", + "id": "order_I7waiV9PUGADuv", "entity": "order", - "amount": 1000, - "amount_paid": 1000, + "amount": 50000, + "amount_paid": 50000, "amount_due": 0, "currency": "INR", - "receipt": null, + "receipt": "55", "offer_id": null, "status": "paid", "attempts": 1, - "notes": [], - "created_at": 1570794714, + "notes": { + "woocommerce_order_number": "55" + }, + "created_at": 1633936677, "transfers": { "entity": "collection", "count": 1, "items": [ { - "id": "trf_DSkl2lXWbiADZG", + "id": "trf_I7waiajxgS5jWL", "entity": "transfer", - "source": "order_DSkl2lBNvueOly", - "recipient": "acc_CNo3jSI8OkFJJJ", - "amount": 500, + "status": "processed", + "source": "order_I7waiV9PUGADuv", + "recipient": "acc_HalyQGZh9ZyiGg", + "amount": 10000, "currency": "INR", "amount_reversed": 0, - "notes": { - "branch": "Acme Corp Bangalore North", - "name": "Gaurav Kumar" - }, - "fees": 2, - "tax": 0, - "on_hold": true, - "on_hold_until": 1670776632, + "fees": 12, + "tax": 2, + "notes": [], + "linked_account_notes": [], + "on_hold": false, + "on_hold_until": null, + "settlement_status": "pending", "recipient_settlement_id": null, - "created_at": 1570794714, - "linked_account_notes": [ - "Acme Corp Bangalore North" - ], - "processed_at": 1570794772 + "created_at": 1633936677, + "processed_at": 1633936700, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_I7waiajxgS5jWL", + "source": null, + "metadata": null + } } ] } } - ``` ------------------------------------------------------------------------------------------------------- @@ -325,22 +356,34 @@ client.transfer.fetch(transferId) **Response:** ```json { - "id": "trf_E7V62rAxJ3zYMo", + "id": "trf_I7waiajxgS5jWL", "entity": "transfer", - "source": "pay_E6j30Iu1R7XbIG", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 100, + "status": "processed", + "source": "order_I7waiV9PUGADuv", + "recipient": "acc_HalyQGZh9ZyiGg", + "amount": 10000, "currency": "INR", "amount_reversed": 0, + "fees": 12, + "tax": 2, "notes": [], - "fees": 1, - "tax": 0, + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, + "settlement_status": "pending", "recipient_settlement_id": null, - "created_at": 1579691505, - "linked_account_notes": [], - "processed_at": 1579691505 + "created_at": 1633936677, + "processed_at": 1633936700, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_I7waiajxgS5jWL", + "source": null, + "metadata": null + } } ``` ------------------------------------------------------------------------------------------------------- @@ -366,22 +409,34 @@ client.transfer.all({ "count": 1, "items": [ { - "id": "trf_DGSTeXzBkEVh48", + "id": "trf_HWjmkReRGPhguR", "entity": "transfer", - "source": "pay_DGSRhvMbOqeCe7", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 500, + "status": "processed", + "source": "pay_HWjY9DZSMsbm5E", + "recipient": "acc_HWjl1kqobJzf4i", + "amount": 1000, "currency": "INR", "amount_reversed": 0, - "notes": [], - "fees": 2, + "fees": 3, "tax": 0, + "notes": [], + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, - "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", - "created_at": 1568110256, - "linked_account_notes": [], - "processed_at": null + "settlement_status": "settled", + "recipient_settlement_id": "setl_HYIIk3H0J4PYdX", + "created_at": 1625812996, + "processed_at": 1625812996, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_HWjmkReRGPhguR", + "source": null, + "metadata": null + } } ] } @@ -409,32 +464,35 @@ client.transfer.all({ "count": 1, "items": [ { - "id": "trf_DGSTeXzBkEVh48", + "id": "trf_JnRRvcSbZb1VHN", "entity": "transfer", - "source": "pay_DGSRhvMbOqeCe7", - "recipient": "acc_CMaomTz4o0FOFz", + "status": "processed", + "source": "acc_HZbJUcl6DBDLIN", + "recipient": "acc_HjVXbtpSCIxENR", "amount": 500, "currency": "INR", "amount_reversed": 0, - "notes": [], - "fees": 2, + "fees": 1, "tax": 0, + "notes": [], + "linked_account_notes": [], "on_hold": false, "on_hold_until": null, - "recipient_settlement_id": "setl_DHYJ3dRPqQkAgV", - "recipient_settlement": { - "id": "setl_DHYJ3dRPqQkAgV", - "entity": "settlement", - "amount": 500, - "status": "failed", - "fees": 0, - "tax": 0, - "utr": "CN0038699836", - "created_at": 1568349124 - }, - "created_at": 1568110256, - "linked_account_notes": [], - "processed_at": null + "settlement_status": null, + "recipient_settlement_id": null, + "recipient_settlement": null, + "created_at": 1656534379, + "processed_at": 1656534379, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_JnRRvcSbZb1VHN", + "source": null, + "metadata": null + } } ] } @@ -461,17 +519,21 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_EAzovSwG8jBnGf", + "id": "rfnd_JJFNlNXPHY640A", "entity": "refund", "amount": 100, "currency": "INR", - "payment_id": "pay_EAdwQDe4JrhOFX", + "payment_id": "pay_JJCqynf4fQS0N1", "notes": [], "receipt": null, "acquirer_data": { - "rrn": null + "arn": null }, - "created_at": 1580454723 + "created_at": 1649941680, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -497,31 +559,37 @@ client.payment.all({ "count": 2, "items": [ { - "id": "pay_E9uth3WhYbh9QV", + "id": "pay_JJCqynf4fQS0N1", "entity": "payment", - "amount": 100, + "amount": 10000, "currency": "INR", "status": "captured", - "order_id": null, + "order_id": "order_JJCqnZG8f3754z", "invoice_id": null, - "international": null, - "method": "transfer", + "international": false, + "method": "netbanking", "amount_refunded": 0, "refund_status": null, "captured": true, - "description": null, + "description": "#JJCqaOhFihfkVE", "card_id": null, - "bank": null, + "bank": "YESB", "wallet": null, "vpa": null, - "email": "", - "contact": null, + "email": "john.example@example.com", + "contact": "+919820958250", "notes": [], - "fee": 0, - "tax": 0, + "fee": 236, + "tax": 36, "error_code": null, "error_description": null, - "created_at": 1580219046 + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": { + "bank_transaction_id": "2118867" + }, + "created_at": 1649932775 } ] } @@ -546,17 +614,21 @@ client.transfer.reverse(transferId,{ **Response:** ```json { - "id": "rvrsl_EB0BWgGDAu7tOz", - "entity": "reversal", - "transfer_id": "trf_EAznuJ9cDLnF7Y", + "id": "rfnd_JJFNlNXPHY640A", + "entity": "refund", "amount": 100, - "fee": 0, - "tax": 0, "currency": "INR", + "payment_id": "pay_JJCqynf4fQS0N1", "notes": [], - "initiator_id": "CJoeHMNpi0nC7k", - "customer_refund_id": null, - "created_at": 1580456007 + "receipt": null, + "acquirer_data": { + "arn": null + }, + "created_at": 1649941680, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -580,10 +652,7 @@ client.payment.transfer(paymentId,{ | Name | Type | Description | |---------------|-------------|---------------------------------------------| | paymentId* | string | The id of the payment to be fetched | -| transfers.account* | string | The id of the account to be fetched | -| transfers.amount* | string | The transaction amount, in paise | -| transfers.currency* | string | The currency of the payment (defaults to INR) | -| transfers.on_hold* | string | Possible values is `0` or `1` | +| transfers | array | All parameters listed [here](https://razorpay.com/docs/api/route/#hold-settlements-for-transfers) are supported | **Response:** ```json @@ -592,22 +661,31 @@ client.payment.transfer(paymentId,{ "count": 1, "items": [ { - "id": "trf_EB1VJ4Ux4GMmxQ", + "id": "trf_Jfm1KCF6w1oWgy", "entity": "transfer", - "source": "pay_EB1R2s8D4vOAKG", - "recipient": "acc_CMaomTz4o0FOFz", + "status": "pending", + "source": "pay_JXPULbHbkkkS8D", + "recipient": "acc_I0QRP7PpvaHhpB", "amount": 100, "currency": "INR", "amount_reversed": 0, "notes": [], - "fees": 1, - "tax": 0, + "linked_account_notes": [], "on_hold": true, "on_hold_until": null, "recipient_settlement_id": null, - "created_at": 1580460652, - "linked_account_notes": [], - "processed_at": 1580460652 + "created_at": 1654860101, + "processed_at": null, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_Jfm1KCF6w1oWgy", + "source": null, + "metadata": null + } } ] } @@ -626,28 +704,44 @@ client.transfer.edit(transferId,{ | Name | Type | Description | |---------------|-------------|---------------------------------------------| -| transferId* | string | The id of the transfer to be fetched | -| transfers | array | All parameters listed here https://razorpay.com/docs/api/route/#hold-settlements-for-transfers are supported | +| transferId* | string | The id of the payment to be fetched | +| on_hold* | boolean | Possible values is `0` or `1` | +| on_hold_until | integer | Timestamp, in Unix, that indicates until when the settlement of the transfer must be put on hold | **Response:** ```json { - "id": "trf_EB17rqOUbzSCEE", - "entity": "transfer", - "source": "pay_EAeSM2Xul8xYRo", - "recipient": "acc_CMaomTz4o0FOFz", - "amount": 100, - "currency": "INR", - "amount_reversed": 0, - "notes": [], - "fees": 1, - "tax": 0, - "on_hold": true, - "on_hold_until": 1679691505, - "recipient_settlement_id": null, - "created_at": 1580459321, - "linked_account_notes": [], - "processed_at": 1580459321 + "entity": "collection", + "count": 1, + "items": [ + { + "id": "trf_JhemwjNekar9Za", + "entity": "transfer", + "status": "pending", + "source": "pay_I7watngocuEY4P", + "recipient": "acc_HjVXbtpSCIxENR", + "amount": 100, + "currency": "INR", + "amount_reversed": 0, + "notes": [], + "linked_account_notes": [], + "on_hold": true, + "on_hold_until": null, + "recipient_settlement_id": null, + "created_at": 1655271313, + "processed_at": null, + "error": { + "code": null, + "description": null, + "reason": null, + "field": null, + "step": null, + "id": "trf_JhemwjNekar9Za", + "source": null, + "metadata": null + } + } + ] } ``` diff --git a/documents/upi.md b/documents/upi.md index 0bbbe311..a4aa0dd4 100644 --- a/documents/upi.md +++ b/documents/upi.md @@ -6,6 +6,7 @@ client.customer.create({ "name": "Gaurav Kumar", "contact": 9123456780, "email": "gaurav.kumar@example.com", + "fail_existing": 0, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." @@ -46,24 +47,20 @@ client.customer.create({ ```py client.order.create({ - "amount": 0, + "amount": 100, "currency": "INR", "method": "upi", "customer_id": "cust_1Aa00000000001", "receipt": "Receipt No. 1", + "token": { + "max_amount": 9999900, + "expire_at": 4102444799, + "frequency": "monthly" + }, "notes": { "notes_key_1": "Beam me up Scotty", "notes_key_2": "Engage" }, - "token": { - "auth_type": "netbanking", - "max_amount": 9999900, - "expire_at": 4102444799, - "notes": { - "notes_key_1": "Tea, Earl Grey, Hot", - "notes_key_2": "Tea, Earl Grey… decaf." - } - } }) ``` @@ -76,7 +73,8 @@ client.order.create({ | method* | string | The authorization method. In this case the value will be `emandate` | | receipt | string | Your system order reference id. | | notes | object | A key-value pair | -| token | object | A key-value pair | +| token | object | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction#112-create-an-order) are supported | + **Response:** ```json @@ -139,18 +137,16 @@ client.registration_link.create({ | Name | Type | Description | |-----------------|---------|------------------------------------------------------------------------------| -| customer | object | Details of the customer to whom the registration link will be sent. | +| customer | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction/#121-create-a-registration-link) are supported | | type* | string | In this case, the value is `link`. | | currency* | string | The 3-letter ISO currency code for the payment. Currently, only `INR` is supported. | | amount* | integer | The payment amount in the smallest currency sub-unit. | | description* | string | A description that appears on the hosted page. For example, `12:30 p.m. Thali meals (Gaurav Kumar`). | -| subscription_registration | object | Details of the authorization payment. | -| notes | object | A key-value pair | -|sms_notify | array | Details of the line item that is billed in the invoice. | -|email_notify | array | Details of the line item that is billed in the invoice. | -|expire_by | array | Details of the line item that is billed in the invoice. | -|receipt | string | Your system order reference id. | -|notes | object | A key-value pair | +| subscription_registration | array | All parameters listed [here](https://razorpay.com/docs/api/payments/recurring-payments/upi/create-authorization-transaction/#121-create-a-registration-link) are supported | +| sms_notify | boolean | SMS notifications are to be sent by Razorpay (default : 1) | +| email_notify | boolean | Email notifications are to be sent by Razorpay (default : 1) | +| expire_by | integer | The timestamp, in Unix format, till when the customer can make the authorization payment. | +| notes | array | A key-value pair | **Response:** ```json @@ -436,6 +432,7 @@ client.order.create({ "amount":1000, "currency":"INR", "receipt":"Receipt No. 1", + "payment_capture":True, "notes": { "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." @@ -450,7 +447,8 @@ client.order.create({ | amount* | integer | Amount of the order to be paid | | currency* | string | Currency of the order. Currently only `INR` is supported. | | receipt | string | Your system order reference id. | -| notes | object | A key-value pair | +| 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 diff --git a/documents/virtualAccount.md b/documents/virtualAccount.md index 7cf2457e..61ad7423 100644 --- a/documents/virtualAccount.md +++ b/documents/virtualAccount.md @@ -21,7 +21,7 @@ client.virtual_account.create({ | Name | Type | Description | |---------------|-------------|---------------------------------------------| -| receivers* | object | Array that defines what receivers are available for this Virtual Account | +| receivers* | object | All parameters listed [here](https://razorpay.com/docs/api/payments/smart-collect/#create-virtual-account) are supported | | description | string | A brief description of the virtual account. | | customer_id | string | Unique identifier of the customer to whom the virtual account must be tagged. | | close_by | integer | UNIX timestamp at which the virtual account is scheduled to be automatically closed. | @@ -213,7 +213,9 @@ client.virtual_account.fetch(virtualId) | virtualId* | string | The id of the virtual to be updated | **Response:** + For fetch virtual account by id response please click [here](https://razorpay.com/docs/api/smart-collect/#fetch-a-virtual-account-by-id) + ------------------------------------------------------------------------------------------------------- ### Fetch all virtual account @@ -225,10 +227,10 @@ client.virtual_account.all(options) | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| from | timestamp | timestamp after which the payments were created | -| to | timestamp | timestamp before which the payments were created | -| count | integer | number of payments to fetch (default: 10) | -| skip | integer | number of payments to be skipped (default: 0) | +| from | timestamp | Timestamp, in seconds, from when virtual accounts are to be fetched. | +| to | timestamp | Timestamp, in seconds, till when virtual accounts are to be fetched. | +| count | integer | Number of virtual accounts to be fetched. The default value is 10 and the maximum value is 100. | +| skip | integer | Number of records to be skipped while fetching the virtual accounts. This can be used for pagination, in combination with `count`. | **Response:** ```json @@ -287,35 +289,38 @@ client.virtual_account.payments(virtualId,options) ```json { "entity": "collection", - "count": 1, + "count": 3, "items": [ { - "id": "pay_Di5iqCqA1WEHq6", + "id": "pay_JccakgG2EZbHZO", "entity": "payment", - "amount": 239000, + "amount": 10000, "currency": "INR", "status": "captured", "order_id": null, "invoice_id": null, "international": false, "method": "bank_transfer", - "amount_refunded": 0, - "refund_status": null, + "amount_refunded": 500, + "refund_status": "partial", "captured": true, "description": "", "card_id": null, "bank": null, "wallet": null, "vpa": null, - "email": "saurav.kumar@example.com", - "contact": "+919972139994", - "customer_id": "cust_DOMUFFiGdCaCUJ", + "email": null, + "contact": null, "notes": [], - "fee": 2820, - "tax": 430, + "fee": 118, + "tax": 18, "error_code": null, "error_description": null, - "created_at": 1574143644 + "error_source": null, + "error_step": null, + "error_reason": null, + "acquirer_data": {}, + "created_at": 1654171877 } ] } @@ -388,7 +393,6 @@ client.payment.bank_transfer(paymentId) ```py client.payment.refund(paymentId,{ "amount": "100", - "speed": "normal", "notes": { "notes_key_1": "Beam me up Scotty.", "notes_key_2": "Engage" @@ -410,20 +414,22 @@ client.payment.refund(paymentId,{ **Response:** ```json { - "id": "rfnd_E6j36ZEKvsWsEn", + "id": "rfnd_FP8QHiV938haTz", "entity": "refund", - "amount": 100, + "amount": 500100, + "receipt": "Receipt No. 31", "currency": "INR", - "payment_id": "pay_E54n391WnEAV9H", - "notes": { - "key_1": "value1", - "key_2": "value2" - }, + "payment_id": "pay_FCXKPFtYfPXJPy", + "notes": [] "receipt": null, "acquirer_data": { - "rrn": null + "arn": null }, - "created_at": 1579522301 + "created_at": 1597078866, + "batch_id": null, + "status": "processed", + "speed_processed": "normal", + "speed_requested": "normal" } ``` ------------------------------------------------------------------------------------------------------- @@ -431,7 +437,7 @@ client.payment.refund(paymentId,{ ### Add receiver to an existing virtual account ```py client.virtual_account.add_receiver(virtualId,{ - "type": [ + "types": [ "vpa" ], "vpa": { @@ -444,7 +450,7 @@ client.virtual_account.add_receiver(virtualId,{ | Name | Type | Description | |-------|-----------|--------------------------------------------------| -| virtualId* | string | The id of the virtual to be updated | +| virtualId* | string | All parameters listed [here](https://razorpay.com/docs/api/payments/smart-collect-tpv#add-receiver-to-an-existing-virtual-account) are supported | | types* | object | The receiver type to be added to the virtual account. Possible values are `vpa` or `bank_account` | | vpa | object | This is to be passed only when `vpa` is passed as the receiver types. | diff --git a/razorpay/client.py b/razorpay/client.py index ba9ad28b..f835e139 100644 --- a/razorpay/client.py +++ b/razorpay/client.py @@ -83,7 +83,7 @@ def _update_user_agent_header(self, options): def _get_version(self): version = "" - try: + try: # nosemgrep : gitlab.bandit.B110 version = pkg_resources.require("razorpay")[0].version except DistributionNotFound: # pragma: no cover pass @@ -137,7 +137,7 @@ def request(self, method, path, **options): raise BadRequestError(msg) elif str.upper(code) == ERROR_CODE.GATEWAY_ERROR: raise GatewayError(msg) - elif str.upper(code) == ERROR_CODE.SERVER_ERROR: + elif str.upper(code) == ERROR_CODE.SERVER_ERROR: # nosemgrep : python.lang.maintainability.useless-ifelse.useless-if-body raise ServerError(msg) else: raise ServerError(msg) diff --git a/razorpay/resources/addon.py b/razorpay/resources/addon.py index 85a995e1..a3953c94 100644 --- a/razorpay/resources/addon.py +++ b/razorpay/resources/addon.py @@ -26,7 +26,9 @@ def delete(self, addon_id, data={}, **kwargs): Args: addon_id : Id for which addon object has to be deleted """ - return super(Addon, self).delete(addon_id, data, **kwargs) + url = '{}/{}'.format(self.base_url, addon_id) + + return self.delete_url(url, data, **kwargs) def all(self, data={}, **kwargs): """" diff --git a/razorpay/resources/payment.py b/razorpay/resources/payment.py index 93a448d2..4c2efe23 100644 --- a/razorpay/resources/payment.py +++ b/razorpay/resources/payment.py @@ -34,7 +34,7 @@ def fetch(self, payment_id, data={}, **kwargs): """ return super(Payment, self).fetch(payment_id, data, **kwargs) - def capture(self, payment_id, amount, data={}, **kwargs): + def capture(self, payment_id, amount, data={}, **kwargs): # nosemgrep : python.lang.correctness.common-mistakes.default-mutable-dict.default-mutable-dict """" Capture Payment for given Id @@ -49,7 +49,7 @@ def capture(self, payment_id, amount, data={}, **kwargs): data['amount'] = amount return self.post_url(url, data, **kwargs) - def refund(self, payment_id, amount, data={}, **kwargs): # pragma: no cover + def refund(self, payment_id, amount, data={}, **kwargs): # pragma: no cover # nosemgrep : python.lang.correctness.common-mistakes.default-mutable-dict.default-mutable-dict """" Refund Payment for given Id @@ -223,3 +223,69 @@ def createRecurring(self, data={}, **kwargs): """ url = "{}/{}/recurring".format(self.base_url,'create') return self.post_url(url, data, **kwargs) + + def createUpi(self, data={}, **kwargs): + """" + Initiate a payment + Return: + Payments dict + """ + url = "{}/create/{}".format(self.base_url,'upi') + return self.post_url(url, data, **kwargs) + + def validateVpa(self, data={}, **kwargs): + """" + Validate the VPA + Return: + Payments dict + """ + url = "{}/validate/{}".format(self.base_url,'vpa') + return self.post_url(url, data, **kwargs) + + def fetchPaymentMethods(self, **kwargs): + """" + Fetch payment methods + Return: + Payments dict + """ + url = "/{}".format('methods') + return self.get_url(url, {}, **kwargs) + + def otpGenerate(self, payment_id, data={}, **kwargs): + """" + Otp Generate + + Args: + payment_id : Id for which upi transfer entity has to be fetched + + Returns: + Otp Dict which was created + """ + url = "{}/{}/otp_generate".format(self.base_url, payment_id) + return self.post_url(url, data, **kwargs) + + def otpSubmit(self, payment_id, data={}, **kwargs): + """" + Otp Submit + + Args: + payment_id : Id for which upi transfer entity has to be fetched + + Returns: + Otp Dict which was created + """ + url = "{}/{}/otp/submit".format(self.base_url, payment_id) + return self.post_url(url, data, **kwargs) + + def otpResend(self, payment_id, data={}, **kwargs): + """" + Otp Resend + + Args: + payment_id : Id for which upi transfer entity has to be fetched + + Returns: + Otp Dict which was created + """ + url = "{}/{}/otp/resend".format(self.base_url, payment_id) + return self.post_url(url, data, **kwargs) diff --git a/setup.py b/setup.py index 36562c2c..2650ecef 100644 --- a/setup.py +++ b/setup.py @@ -5,7 +5,7 @@ setup( name="razorpay", - version="1.3.0", + version="1.3.1", description="Razorpay Python Client", long_description=readme_content, long_description_content_type='text/markdown', diff --git a/test.py b/test.py new file mode 100644 index 00000000..68716cb7 --- /dev/null +++ b/test.py @@ -0,0 +1,29 @@ +import razorpay +import requests +from pprint import pprint +import json + +client = razorpay.Client(auth=("rzp_test_k6uL897VPBz20q", "EnLs21M47BllR3X8PSFtjtbd")) + +data = {"customer_id":"cust_JnFmpXS63vWgYJ"} + +#x = client.addon.delete("ao_JniYt836HF7aQm") + +x = client.transfer.all({ + 'expand[]':'recipient_settlement' +}) + +print(json.dumps(x)) + + # def delete(self, addon_id, data={}, **kwargs): + # """ + # Delete addon for given id + + # Args: + # addon_id : Id for which addon object has to be deleted + # """ + # url = '{}/{}'.format(self.base_url, addon_id) + + # return self.delete_url(url, data, **kwargs) +# "please check response error_code , error_desc , tax and other are missing +# tested with account va_JccSJQQoGOBi2q" \ No newline at end of file diff --git a/tests/mocks/fake_otp_generate.json b/tests/mocks/fake_otp_generate.json new file mode 100644 index 00000000..26f14941 --- /dev/null +++ b/tests/mocks/fake_otp_generate.json @@ -0,0 +1,19 @@ +{ + "razorpay_payment_id": "pay_FVmAstJWfsD3SO", + "next": [ + { + "action": "otp_submit", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_submit/ac2d415a8be7595de09a24b41661729fd9028fdc?key_id=" + }, + { + "action": "otp_resend", + "url": "https://api.razorpay.com/v1/payments/pay_FVmAstJWfsD3SO/otp_resend/json?key_id=" + } + ], + "metadata": { + "issuer": "HDFC", + "network": "MC", + "last4": "1111", + "iin": "411111" + } +} diff --git a/tests/mocks/fake_otp_resend.json b/tests/mocks/fake_otp_resend.json new file mode 100644 index 00000000..1cca81f1 --- /dev/null +++ b/tests/mocks/fake_otp_resend.json @@ -0,0 +1,7 @@ +{ + "next": [ + "otp_submit", + "otp_resend" + ], + "razorpay_payment_id": "pay_JWaNvYmrx75sXo" + } \ No newline at end of file diff --git a/tests/mocks/fake_otp_submit.json b/tests/mocks/fake_otp_submit.json new file mode 100644 index 00000000..b13b5b23 --- /dev/null +++ b/tests/mocks/fake_otp_submit.json @@ -0,0 +1,5 @@ +{ + "razorpay_payment_id": "pay_D5jmY2H6vC7Cy3", + "razorpay_order_id": "order_9A33XWu170gUtm", + "razorpay_signature": "9ef4dffbfd84f1318f6739a3ce19f9d85851857ae648f114332d8401e0949a3d" +} diff --git a/tests/test_client_addon.py b/tests/test_client_addon.py index 9a4d9588..f5a9e1bd 100644 --- a/tests/test_client_addon.py +++ b/tests/test_client_addon.py @@ -22,7 +22,7 @@ def test_addon_fetch(self): @responses.activate def test_addon_delete(self): result = [] - url = '{}/{}/delete'.format(self.base_url, self.addon_id) + url = '{}/{}'.format(self.base_url, self.addon_id) responses.add(responses.DELETE, url, status=200, diff --git a/tests/test_client_payment.py b/tests/test_client_payment.py index 794ccad0..0440f94f 100644 --- a/tests/test_client_payment.py +++ b/tests/test_client_payment.py @@ -196,8 +196,9 @@ def test_payment_json(self): responses.add(responses.POST, url, status=200, body=json.dumps(result), match_querystring=True) self.assertEqual(self.client.payment.createPaymentJson(param), result) - - def createRecurring(self): + + @responses.activate + def test_createRecurring(self): init = mock_file('init_create_recurring') result = mock_file('fake_create_recurring') url = "{}/{}/recurring".format(self.base_url,'create') @@ -208,3 +209,43 @@ def createRecurring(self): match_querystring=True) self.assertEqual(self.client.payment.createRecurring(init), result) + + @responses.activate + def test_otpGenerate(self): + result = mock_file('fake_otp_generate') + url = "{}/{}/otp_generate".format(self.base_url,'dummy_id') + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.payment.otpGenerate('dummy_id'), result) + + @responses.activate + def test_otpSubmit(self): + param = { + "otp": "123456" + } + + result = mock_file('fake_otp_submit') + url = "{}/{}/otp/submit".format(self.base_url,'dummy_id') + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.payment.otpSubmit('dummy_id',param), result) + + @responses.activate + def test_otpResend(self): + result = mock_file('fake_otp_resend') + url = "{}/{}/otp/resend".format(self.base_url,'dummy_id') + responses.add(responses.POST, + url, + status=200, + body=json.dumps(result), + match_querystring=True) + + self.assertEqual(self.client.payment.otpResend('dummy_id'), result) \ No newline at end of file