### Install via Scoop (Windows) Source: https://razorpay.com/docs/api/install-cli Install the Razorpay CLI using the Scoop package manager on Windows. ```PowerShell scoop install razorpay ``` -------------------------------- ### Quick Install Script (macOS/Linux) Source: https://razorpay.com/docs/api/install-cli Use this script to automatically detect your OS and architecture, download the latest binary, and install it to ~/.local/bin. ```Bash curl -fsSL https://razorpay.com/cli/latest/install.sh | bash ``` -------------------------------- ### Fetch All Payment Links Source: https://razorpay.com/docs/api/payments/payment-links/fetch-all-standard This example demonstrates how to fetch all payment links using a GET request to the Razorpay API. It includes authentication details and the expected response structure. ```APIDOC ## GET /v1/payment_links/ ### Description Fetches a list of all payment links. ### Method GET ### Endpoint https://api.razorpay.com/v1/payment_links/ ### Parameters #### Query Parameters - **count** (integer) - Optional - Number of payment links to retrieve per page. Default is 10. - **skip** (integer) - Optional - Number of payment links to skip. Default is 0. ### Request Example ```bash curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \ -X GET https://api.razorpay.com/v1/payment_links/ \ -H "content-type: application/json" ``` ### Response #### Success Response (200) - **payment_links** (array) - An array of payment link objects. - **id** (string) - Unique identifier for the payment link. - **entity** (string) - Type of entity, always 'payment_link'. - **amount** (integer) - The amount to be paid in the smallest currency unit (e.g., paise for INR). - **currency** (string) - The currency of the payment link (e.g., 'INR', 'USD'). - **accept_partial** (boolean) - Whether partial payments are allowed. - **first_min_partial_amount** (integer) - The minimum amount for the first partial payment, if `accept_partial` is true. - **reference_id** (string) - A unique reference ID for the payment link. - **description** (string) - A description for the payment link. - **customer** (object) - Details of the customer associated with the payment link. - **id** (string) - Customer ID. - **name** (string) - Customer name. - **contact** (string) - Customer contact number. - **email** (string) - Customer email address. - **notify** (object) - Notification preferences. - **email** (boolean) - Whether to send email notifications. - **sms** (boolean) - Whether to send SMS notifications. - **reminder_enable** (boolean) - Whether reminders are enabled for the payment link. - **created_at** (integer) - Timestamp when the payment link was created. - **updated_at** (integer) - Timestamp when the payment link was last updated. - **status** (string) - Current status of the payment link (e.g., 'created', 'paid', 'expired', 'cancelled'). - **paid_at** (integer) - Timestamp when the payment was completed. - **short_url** (string) - A short URL to share the payment link. - **long_url** (string) - The full URL for the payment link. - **user_id** (string) - The ID of the user who created the payment link. - **order_id** (string) - The ID of the associated order, if any. - **upi_link** (boolean) - Whether this is a UPI link. - **expire_by** (integer) - Timestamp by which the payment link should be paid. - **expired_at** (integer) - Timestamp when the payment link expired. - **cancelled_at** (integer) - Timestamp when the payment link was cancelled. - **notes** (array) - Any additional notes associated with the payment link. #### Response Example ```json { "payment_links": [ { "accept_partial": true, "amount": 10000, "amount_paid": 10000, "cancelled_at": 0, "created_at": 1661852539, "currency": "USD", "customer": [], "description": "Grocery", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_KBnb7I424Rc1R9", "notes": [], "notify": { "email": false, "sms": false }, "order_id": "order_KBneAVhT2zbzsU", "payments": [], "reference_id": "111", "reminder_enable": false, "reminders": [], "short_url": "https://rzp.io/i/alaBxs0i", "status": "paid", "updated_at": 1661852741, "upi_link": false, "user_id": "HD1JAKCCPGDfRx" } ] } ``` ``` -------------------------------- ### Verify Installation Source: https://razorpay.com/docs/api/install-cli Verify that the Razorpay CLI has been installed correctly by checking its version. ```Bash razorpay --version ``` -------------------------------- ### Install via Homebrew (macOS) Source: https://razorpay.com/docs/api/install-cli Install the Razorpay CLI using the Homebrew package manager on macOS. ```Bash brew install razorpay/razorpay-cli/razorpay ``` -------------------------------- ### Fetch All Orders Response Example Source: https://razorpay.com/docs/api/orders/fetch-all This is a sample JSON response when successfully fetching all orders. It includes collection details and a list of individual order items with their respective fields. ```json { "entity": "collection", "count": 2, "items": [ { "id": "order_EKzX2WiEWbMxmx", "entity": "order", "amount": 1234, "amount_paid": 0, "amount_due": 1234, "currency": "USD", "receipt": "Receipt No. 1", "offer_id": null, "status": "created", "attempts": 0, "notes": [], "created_at": 1582637108 }, { "id": "order_EAI5nRfThga2TU", "entity": "order", "amount": 100, "amount_paid": 0, "amount_due": 100, "currency": "USD", "receipt": "Receipt No. 1", "offer_id": null, "status": "created", "attempts": 0, "notes": [], "created_at": 1580300731 } ] } ``` -------------------------------- ### Create Payment Link with Custom Options Source: https://razorpay.com/docs/api/payments/payment-links/customise-options-config This example demonstrates how to create a payment link and customize the checkout display options, including specifying which payment methods to show and their order. ```APIDOC ## POST /v1/payment_links ### Description Use this API endpoint for Reordered Payment Methods. ### Method POST ### Endpoint https://api.razorpay.com/v1/payment_links/ ### Parameters #### Request Body - **amount** (integer) - Required - The amount to be charged. - **currency** (string) - Required - The currency of the amount. - **accept_partial** (boolean) - Optional - Whether to accept partial payments. - **first_min_partial_amount** (integer) - Optional - The minimum amount for the first partial payment. - **reference_id** (string) - Required - Your internal reference ID for the payment. - **description** (string) - Optional - A description for the payment. - **customer** (object) - Optional - Customer details. - **name** (string) - Optional - Customer name. - **contact** (string) - Required - Customer contact number. - **email** (string) - Optional - Customer email. - **notify** (object) - Optional - Notification preferences. - **sms** (boolean) - Optional - Enable SMS notifications. - **email** (boolean) - Optional - Enable email notifications. - **reminder_enable** (boolean) - Optional - Enable reminders for the payment. - **options** (object) - Optional - Customization options for the checkout. - **checkout** (object) - Optional - Checkout display configuration. - **config** (object) - Optional - Configuration for the checkout display. - **display** (object) - Optional - Display settings. - **blocks** (object) - Optional - Defines payment method blocks. - **banks** (object) - Optional - Configuration for bank payment methods. - **name** (string) - Optional - Name of the block. - **instruments** (array) - Optional - List of instruments to display. - **method** (string) - Required - The payment method (e.g., "card"). - **sequence** (array) - Optional - The order in which blocks should appear. - **preferences** (object) - Optional - User preferences for display. - **show_default_blocks** (boolean) - Optional - Whether to show default blocks. ### Request Example ```json { "amount": 1000, "currency": "USD", "accept_partial": true, "first_min_partial_amount": 100, "reference_id": "#21132", "description": "Payment for policy no #23456", "customer": { "name": "John Smith", "contact": "+11234567890", "email": "john.smith@example.com" }, "notify": { "sms": true, "email": true }, "reminder_enable": true, "options": { "checkout": { "config": { "display": { "blocks": { "banks": { "name": "All Payment Methods", "instruments": [ { "method": "card" } ] } }, "sequence": [ "block.banks" ], "preferences": { "show_default_blocks": false } } } } } } ``` ### Response #### Success Response (200) - **id** (string) - The unique ID of the created payment link. - **entity** (string) - The type of entity created (e.g., "payment_link"). - **amount** (integer) - The amount of the payment link. - **currency** (string) - The currency of the payment link. - **status** (string) - The current status of the payment link (e.g., "created"). - **description** (string) - The description of the payment link. - **reference_id** (string) - The reference ID provided. - **customer** (object) - Details of the customer. - **notify** (object) - Notification settings. - **reminder_enable** (boolean) - Indicates if reminders are enabled. - **created_at** (integer) - Timestamp when the payment link was created. - **short_url** (string) - A short URL to the payment link. #### Response Example ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596188911, "currency": "USD", "customer": { "contact": "+11234567890", "email": "john.smith@example.com", "name": "John Smith" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL3i7DFZwKOaCu", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#21132", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/l3IB1Sc", "source": "", "source_id": "", "status": "created", "updated_at": 1596188911, "user_id": "" } ``` ``` -------------------------------- ### Payment Link Creation with Custom Payment Methods Source: https://razorpay.com/docs/api/payments/payment-links/customise-payment-methods This example demonstrates how to create a Payment Link with various customization options, including partial payments, expiration, notifications, and specific payment method configurations. ```APIDOC ## POST /v1/payment_links ### Description Create a Payment Link with customizable payment methods and options. ### Method POST ### Endpoint /v1/payment_links ### Parameters #### Request Body - **amount** (integer) - Required - Amount to be paid using the Payment Link. Must be in the smallest unit of the currency. - **currency** (string) - Optional - A three-letter ISO code for the currency. - **accept_partial** (boolean) - Optional - Indicates whether customers can make partial payments. `true` to allow, `false` (default) to disallow. - **first_min_partial_amount** (integer) - Optional - Minimum amount for the first partial payment. Must be passed along with `accept_partial`. - **description** (string) - Optional - A brief description of the Payment Link. Max 2048 characters. - **reference_id** (string) - Optional - Reference number for the Payment Link. Must be unique. Max 40 characters. - **customer** (json object) - Optional - Customer details. - **expire_by** (integer) - Optional - Timestamp (Unix) when the Payment Link will expire. Cannot exceed six months from creation. - **notify** (array) - Optional - Defines who handles Payment Link notifications. - **notes** (json object) - Optional - Key-value pairs for additional information. Max 15 pairs, 256 characters each. - **callback_url** (string) - Optional - Redirect URL after payment completion. - **callback_method** (string) - Optional - Method for the callback URL. Must be `get` if `callback_url` is provided. - **reminder_enable** (boolean) - Optional - `true` to send reminders, `false` to disable. - **options** (array) - Optional - Options to display or hide payment methods on the Checkout section. - **checkout** (json object) - Optional - Configuration for checkout options. - **method** (string) - Optional - Specifies the payment method to be displayed or hidden. Example: `"card"`. ``` -------------------------------- ### Customise Payment Methods (Example 2) Source: https://razorpay.com/docs/api/payments/payment-links Customizes available payment methods using Options and Config Parameters. ```APIDOC ## Customise Payment Methods (Example 2) ### Description Customises Payment Methods with the Options and Config Parameters. ### Method POST ### Endpoint /v1/payment_links/config/payment_methods ``` -------------------------------- ### Create Payment Link with Custom Labels Source: https://razorpay.com/docs/api/payments/payment-links/rename-payment-details-labels This example demonstrates how to create a payment link and customize the labels for various payment details using the `options.hosted_page.label` object. This allows for a more tailored user experience on the hosted payment page. ```APIDOC ## POST /v1/payment_links ### Description Creates a payment link with customizable labels for payment details on the hosted page. ### Method POST ### Endpoint https://api.razorpay.com/v1/payment_links/ ### Parameters #### Request Body - **amount** (integer) - Required - The amount to be charged. - **currency** (string) - Required - The currency of the amount. - **accept_partial** (boolean) - Optional - Allows partial payments. - **first_min_partial_amount** (integer) - Optional - The minimum amount for the first partial payment. - **reference_id** (string) - Optional - Your internal reference ID for the payment. - **description** (string) - Optional - A description for the payment. - **expire_by** (integer) - Optional - Epoch time until which the payment link is valid. - **customer** (object) - Optional - Customer details. - **name** (string) - Optional - Customer name. - **contact** (string) - Optional - Customer contact number. - **email** (string) - Optional - Customer email. - **notify** (object) - Optional - Notification preferences. - **sms** (boolean) - Optional - Enable SMS notifications. - **email** (boolean) - Optional - Enable email notifications. - **reminder_enable** (boolean) - Optional - Enable reminders for the payment. - **options** (object) - Optional - Additional options for the hosted page. - **hosted_page** (object) - Optional - Configuration for the hosted payment page. - **label** (object) - Optional - Custom labels for payment details. - **receipt** (string) - Optional - Label for receipt. - **description** (string) - Optional - Label for description. - **amount_payable** (string) - Optional - Label for amount payable. - **amount_paid** (string) - Optional - Label for amount paid. - **partial_amount_due** (string) - Optional - Label for partial amount due. - **partial_amount_paid** (string) - Optional - Label for partial amount paid. - **expire_by** (string) - Optional - Label for expiry date. - **expired_on** (string) - Optional - Label for expired on message. - **amount_due** (string) - Optional - Label for amount due. - **show_preferences** (object) - Optional - Preferences for showing details on the hosted page. - **issued_to** (boolean) - Optional - Whether to show 'issued to' field. ### Request Example ```json { "amount": 1000, "currency": "USD", "accept_partial": true, "first_min_partial_amount": 100, "reference_id": "#412232", "description": "Payment for policy no #23456", "expire_by": 1599193801, "customer": { "name": "John Smith", "contact": "+11234567890", "email": "john.smith@example.com" }, "notify": { "sms": true, "email": true }, "reminder_enable": true, "options": { "hosted_page": { "label": { "receipt": "Ref No.", "description": "Course Name", "amount_payable": "Course Fee Payable", "amount_paid": "Course Fee Paid", "partial_amount_due": "Fee Installment Due", "partial_amount_paid": "Fee Installment Paid", "expire_by": "Pay Before", "expired_on": "Link Expired. Please contact Admin", "amount_due": "Course Fee Due" }, "show_preferences": { "issued_to": false } } } } ``` ### Response #### Success Response (200) - **id** (string) - Unique identifier for the payment link. - **entity** (string) - Entity type, typically 'payment_link'. - **amount** (integer) - The amount of the payment link. - **currency** (string) - The currency of the payment link. - **accept_partial** (boolean) - Indicates if partial payments are accepted. - **first_min_partial_amount** (integer) - The minimum amount for the first partial payment. - **reference_id** (string) - The reference ID provided by the user. - **description** (string) - The description of the payment link. - **status** (string) - The current status of the payment link (e.g., 'created', 'paid', 'expired'). - **created_at** (integer) - Epoch timestamp when the payment link was created. - **expire_by** (integer) - Epoch timestamp until which the payment link is valid. - **expired_at** (integer) - Epoch timestamp when the payment link expired. - **short_url** (string) - A short URL to the payment link. - **notes** (object) - Any notes associated with the payment link. - **customer** (object) - Details of the customer. - **notify** (object) - Notification preferences. - **reminder_enable** (boolean) - Indicates if reminders are enabled. - **payments** (null) - Placeholder for payment details. - **deleted_at** (integer) - Epoch timestamp when the payment link was deleted. - **callback_url** (string) - The URL to redirect to after payment. - **callback_method** (string) - The HTTP method for the callback URL. - **cancelled_at** (integer) - Epoch timestamp when the payment link was cancelled. - **source** (string) - The source of the payment link creation. - **source_id** (string) - The ID of the source. - **user_id** (string) - The ID of the user who created the payment link. - **amount_paid** (integer) - The amount that has been paid. - **partial_amount_due** (integer) - The remaining partial amount due. - **partial_amount_paid** (integer) - The partial amount that has been paid. - **reminders** (array) - List of reminders sent for the payment link. #### Response Example ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596193858, "currency": "USD", "customer": { "contact": "+11234567890", "email": "john.smith@example.com", "name": "John Smith" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 1599193801, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL57CoEC2ulpzL", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#412232", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/bDsi7WW", "source": "", "source_id": "", "status": "created", "updated_at": 1596193858, "user_id": "" } ``` ``` -------------------------------- ### Start Payment with JSONObject Options Source: https://razorpay.com/docs/payments/payment-gateway/android-integration/standard/integration-steps Instantiate the Checkout class and pass payment details and options as a JSONObject. Ensure the order_id from Step 3 is included. This method launches the Razorpay Checkout form. ```Java public void startPayment() { checkout.setKeyID(""); /** * Instantiate Checkout */ Checkout checkout = new Checkout(); /** * Set your logo here */ checkout.setImage(R.drawable.logo); /** * Reference to current activity */ final Activity activity = this; /** * Pass your payment options to the Razorpay Checkout as a JSONObject */ try { JSONObject options = new JSONObject(); options.put("name", "Merchant Name"); options.put("description", "Reference No. #123456"); options.put("image", "http://example.com/image/rzp.jpg"); options.put("order_id", "order_DBJOWzybf0sJbb");//from response of step 3. options.put("theme.color", "#3399cc"); options.put("currency", "USD"); options.put("amount", "50000");//pass amount in currency subunits options.put("prefill.email", "john.smith@example.com"); options.put("prefill.contact","+11234567890"); JSONObject retryObj = new JSONObject(); retryObj.put("enabled", true); retryObj.put("max_count", 4); options.put("retry", retryObj); checkout.open(activity, options); } catch(Exception e) { Log.e(TAG, "Error in starting Razorpay Checkout", e); } } ``` -------------------------------- ### Fetch Orders with Expanded Card Payments Source: https://razorpay.com/docs/api/orders/fetch-all-expanded-card-payments This example demonstrates how to make a GET request to the Razorpay API to retrieve orders and expand the associated payments, specifically including card details. ```APIDOC ## GET /v1/orders?expand[]=payments.card ### Description Fetches a collection of orders, with the option to expand the associated payments to include detailed card information. ### Method GET ### Endpoint https://api.razorpay.com/v1/orders?expand[]=payments.card ### Parameters #### Query Parameters - **expand[]** (string) - Optional - Specifies which related resources to expand. Use `payments.card` to include card details in the payment information. ### Request Example ```bash curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \ -X GET https://api.razorpay.com/v1/orders?expand[]=payments.card ``` ### Response #### Success Response (200) Returns a collection of order objects, where each order may contain expanded payment details including card information. - **entity** (string) - The type of the returned object, expected to be "collection". - **count** (integer) - The number of items in the collection. - **items** (array) - An array of order objects. - **id** (string) - The unique identifier for the order. - **entity** (string) - The type of the object, expected to be "order". - **amount** (integer) - The total amount of the order. - **amount_paid** (integer) - The amount that has been paid for the order. - **amount_due** (integer) - The amount that is still due for the order. - **currency** (string) - The currency of the order amount. - **receipt** (string) - The receipt ID associated with the order. - **payments** (object) - Information about the payments made for the order. - **entity** (string) - The type of the returned object, expected to be "collection". - **count** (integer) - The number of payments. - **items** (array) - An array of payment objects. - **id** (string) - The unique identifier for the payment. - **entity** (string) - The type of the object, expected to be "payment". - **amount** (integer) - The amount of the payment. - **currency** (string) - The currency of the payment amount. - **status** (string) - The status of the payment (e.g., "captured"). - **order_id** (string) - The ID of the order this payment belongs to. - **method** (string) - The payment method used (e.g., "card"). - **captured** (boolean) - Indicates if the payment has been captured. - **card** (object) - Details of the card used for the payment. - **id** (string) - The unique identifier for the card. - **entity** (string) - The type of the object, expected to be "card". - **last4** (string) - The last 4 digits of the card number. - **network** (string) - The card network (e.g., "Visa"). - **type** (string) - The type of the card (e.g., "debit"). - **created_at** (integer) - The timestamp when the payment was created. - **created_at** (integer) - The timestamp when the order was created. #### Response Example ```json { "entity": "collection", "count": 1, "items": [ { "id": "order_MjehF7I6RXSm2o", "entity": "order", "amount": 500, "amount_paid": 500, "amount_due": 0, "currency": "USD", "receipt": null, "payments": { "entity": "collection", "count": 1, "items": [ { "id": "pay_MjehkbJc3pPERF", "entity": "payment", "amount": 500, "currency": "USD", "status": "captured", "order_id": "order_MjehF7I6RXSm2o", "method": "card", "captured": true, "card": { "id": "card_MjehkeMkNIzhOb", "entity": "card", "last4": "0153", "network": "Visa", "type": "debit" }, "created_at": 1696318958 } ] }, "created_at": 1696318929 } ] } ``` ###### Errors Error Status: 4xx The API {key/secret} provided is invalid. The API credentials passed in the API call differ from the ones generated on the Dashboard. Solution Change the API key and secret to the correct ones. ``` -------------------------------- ### Customize Checkout Labels Source: https://razorpay.com/docs/api/payments/payment-links/rename-checkout-labels This example demonstrates how to customize the labels for partial payment options on the checkout page. ```APIDOC ## POST /v1/payment_links/ ### Description This endpoint allows you to create a payment link and customize the labels displayed on the checkout page, particularly for partial payment options. ### Method POST ### Endpoint https://api.razorpay.com/v1/payment_links/ ### Request Body - **amount** (integer) - Required - The amount to be charged for the payment. - **currency** (string) - Required - The currency of the amount. - **accept_partial** (boolean) - Optional - Whether to accept partial payments. - **first_min_partial_amount** (integer) - Optional - The minimum amount for the first partial payment. - **reference_id** (string) - Optional - A unique reference ID for the payment. - **description** (string) - Optional - A description for the payment. - **customer** (object) - Optional - Customer details. - **name** (string) - Required - Customer's name. - **contact** (string) - Required - Customer's contact number. - **email** (string) - Required - Customer's email address. - **notify** (object) - Optional - Notification settings. - **sms** (boolean) - Required - Whether to send SMS notifications. - **email** (boolean) - Required - Whether to send email notifications. - **reminder_enable** (boolean) - Optional - Whether to enable reminders. - **options** (object) - Optional - Customization options. - **checkout** (object) - Optional - Checkout page customization. - **partial_payment** (object) - Optional - Partial payment label customization. - **min_amount_label** (string) - Optional - Label for the minimum amount to be paid. - **partial_amount_label** (string) - Optional - Label for the partial payment option. - **partial_amount_description** (string) - Optional - Description for the partial payment amount. - **full_amount_label** (string) - Optional - Label for paying the full amount. ### Request Example ```json { "amount": 1000, "currency": "USD", "accept_partial": true, "first_min_partial_amount": 100, "reference_id": "#421", "description": "Payment for policy no #23456", "customer": { "name": "John Smith", "contact": "+11234567890", "email": "john.smith@example.com" }, "notify": { "sms": true, "email": true }, "reminder_enable": true, "options": { "checkout": { "partial_payment": { "min_amount_label": "Minimum Money to be paid", "partial_amount_label": "Pay in parts", "partial_amount_description": "Pay at least ₹100", "full_amount_label": "Pay the entire amount" } } } } ``` ### Response #### Success Response (200) - **id** (string) - The unique ID of the created payment link. - **entity** (string) - The type of entity (e.g., 'payment_link'). - **amount** (integer) - The amount of the payment link. - **currency** (string) - The currency of the payment link. - **status** (string) - The current status of the payment link (e.g., 'created'). - **description** (string) - The description of the payment link. - **customer** (object) - Details of the customer. - **notify** (object) - Notification settings. - **options** (object) - Customization options applied. #### Response Example ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596193199, "currency": "USD", "customer": { "contact": "+11234567890", "email": "john.smith@example.com", "name": "John Smith" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL4vbXVKfW7PAz", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#42321", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/F4GC9z1", "source": "", "source_id": "", "status": "created", "updated_at": 1596193199, "user_id": "" } ``` ``` -------------------------------- ### Customise Payment Methods (Example 1) Source: https://razorpay.com/docs/api/payments/payment-links Customizes available payment methods using Options and Method Parameters. ```APIDOC ## Customise Payment Methods (Example 1) ### Description Customises Payment Methods with the Options and Method Parameters. ### Method POST ### Endpoint /v1/payment_links/config/payment_methods ``` -------------------------------- ### Fetch All Payment Downtime Details Source: https://razorpay.com/docs/api/payments/downtime/fetch-all Use this endpoint to retrieve details of all payment downtimes. This is a GET request to the /v1/payments/downtimes endpoint. ```curl curl -u : \ -X GET https://api.razorpay.com/v1/payments/downtimes \ -H "Content-Type: application/json" \ ``` -------------------------------- ### Download and Extract Binary (macOS Intel) Source: https://razorpay.com/docs/api/install-cli Download the Razorpay CLI binary for Intel Macs and extract it. ```Bash curl -fsSL https://razorpay.com/cli/latest/razorpay_mac-os_x86_64.tar.gz | tar -xz ``` -------------------------------- ### Fetch All Expanded Payments Source: https://razorpay.com/docs/api/orders/fetch-all-expanded-payments This endpoint retrieves a list of all payments with their expanded details. It's useful for getting a comprehensive view of all payment transactions. ```APIDOC ## GET /v1/payments ### Description Retrieves a list of all payments with expanded details. ### Endpoint /v1/payments ### Response #### Success Response (200) - **entity** (string) - The type of entity (e.g., 'payment'). - **count** (integer) - The total number of payments. - **items** (array) - An array of payment objects. - **id** (string) - The unique identifier for the payment. - **entity** (string) - The entity type ('payment'). - **amount** (integer) - The payment amount in the smallest currency unit. - **currency** (string) - The currency code (e.g., 'INR'). - **order_id** (string) - The ID of the associated order. - **invoice_id** (string) - The ID of the associated invoice. - **international** (boolean) - Indicates if the payment is international. - **method** (string) - The payment method used (e.g., 'card', 'netbanking'). - **amount_refunded** (integer) - The amount that has been refunded. - **refund_status** (string) - The status of the refund ('none', 'partial', 'full'). - **capture_method** (string) - The capture method ('automatic' or 'manual'). - **description** (string) - A description of the payment. - **email** (string) - The email address of the customer. - **contact** (string) - The contact number of the customer. - **fee** (integer) - The transaction fee. - **tax** (integer) - The transaction tax. - **status** (string) - The current status of the payment ('created', 'authorized', 'captured', 'failed', 'refunded'). - **order_id** (string) - The ID of the associated order. - **created_at** (integer) - The timestamp when the payment was created. - **bank_account** (object) - Details of the bank account used for the payment. - **card_network** (string) - The network of the card. - **card_type** (string) - The type of the card. - **bank_name** (string) - The name of the bank. - **error_details** (object) - Details about any errors encountered during the payment. - **error_code** (string) - The error code. - **error_description** (string) - A description of the error. - **error_source** (string) - The source of the error. - **error_step** (string) - The step where the error occurred. - **error_reason** (string) - The reason for the error. - **created_at** (integer) - The timestamp when the error occurred. #### Response Example { "entity": "payment", "count": 1, "items": [ { "id": "pay_Ff4j7f8f8f8f8f", "entity": "payment", "amount": 50000, "currency": "INR", "order_id": "order_Ff4j7f8f8f8f8f", "invoice_id": null, "international": false, "method": "card", "amount_refunded": 0, "refund_status": null, "capture_method": "automatic", "description": "Test payment", "email": "test@example.com", "contact": "+919999999999", "fee": 1500, "tax": 270, "status": "captured", "order_id": "order_Ff4j7f8f8f8f8f", "created_at": 1589160718, "bank_account": { "card_network": "Visa", "card_type": "debit", "bank_name": "Test Bank" }, "error_details": { "error_code": null, "error_description": null, "error_source": null, "error_step": null, "error_reason": null, "created_at": 1589269450 } } ] } ``` -------------------------------- ### Download and Extract Binary (macOS Apple Silicon) Source: https://razorpay.com/docs/api/install-cli Download the Razorpay CLI binary for Apple Silicon Macs and extract it. ```Bash curl -fsSL https://razorpay.com/cli/latest/razorpay_mac-os_arm64.tar.gz | tar -xz ``` -------------------------------- ### Make Binary Executable and Remove Quarantine (macOS) Source: https://razorpay.com/docs/api/install-cli Make the Razorpay CLI binary executable and remove the macOS quarantine attribute. ```Bash chmod +x ./razorpay xattr -d com.apple.quarantine ./razorpay ``` -------------------------------- ### Resend Notification via Email Source: https://razorpay.com/docs/api/payments/payment-links/resend This example demonstrates how to resend a payment link notification via email. The endpoint and method remain the same, only the 'medium' parameter changes. ```curl curl -u [YOUR_KEY_ID]:[YOUR_KEY_SECRET] \ -X POST https://api.razorpay.com/v1/payment_links/plink_Et2G7ymGcTTuM5/notify_by/email \ ``` -------------------------------- ### Configure API Credentials Interactively Source: https://razorpay.com/docs/api/install-cli Configure the Razorpay CLI by running the command without arguments and entering your API credentials when prompted. ```Bash razorpay configure ``` ```Bash Razorpay Key ID [None]: rzp_test_xxxxxxxxxxxx Razorpay Key Secret [None]: xxxxxxxxxxxxxxxxxxxx ``` -------------------------------- ### Sample Order Response Source: https://razorpay.com/docs/api/orders/fetch-with-id This is a sample JSON response when successfully fetching an order. It includes details such as order ID, amount, currency, status, and creation timestamp. ```json { "id": "order_DaaS6LOUAASb7Y", "entity": "order", "amount": 2000, "amount_paid": 0, "amount_due": 2000, "currency": "USD", "receipt": null, "offer_id": "offer_JGQvQtvJmVDRIA", "offers": [ "offer_JGQvQtvJmVDRIA" ], "status": "created", "attempts": 0, "notes": [], "created_at": 1654776878 } ```