### Customer Creation Response Example Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/papernach.md This is an example of the JSON response received after successfully creating a customer. ```json { "id": "cust_1Aa00000000003", "entity": "customer", "name": "Gaurav Kumar", "email": "Gaurav.Kumar@example.com", "contact": "9000000000", "gstin": null, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." }, "created_at": 1582033731 } ``` -------------------------------- ### Product Configuration Response Example - JSON Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/productConfiguration.md This is an example of the response received after requesting a product configuration. It details active settings, payment methods, and any pending requirements. ```json { "requested_configuration": { "payment_methods": [] }, "active_configuration": { "payment_capture": { "mode": "automatic", "refund_speed": "normal", "automatic_expiry_period": 7200 }, "settlements": { "account_number": null, "ifsc_code": null, "beneficiary_name": null }, "checkout": { "theme_color": "#FFFFFF", "flash_checkout": true, "logo": "https://example.com/your_logo" }, "refund": { "default_refund_speed": "normal" }, "notifications": { "whatsapp": true, "sms": false, "email": [ "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com" ] }, "payment_methods": { "netbanking": { "enabled": true, "instrument": [ { "type": "retail", "bank": [ "hdfc", "sbin", "utib", "icic", "scbl", "yesb" ] } ] }, "wallet": { "enabled": true, "instrument": [ "airtelmoney", "freecharge", "jiomoney", "olamoney", "payzapp", "mobikwik" ] }, "upi": { "enabled": true, "instrument": [ "upi" ] } } }, "requirements": [ { "field_reference": "individual_proof_of_address", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", "status": "required", "reason_code": "document_missing" }, { "field_reference": "individual_proof_of_identification", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", "status": "required", "reason_code": "document_missing" }, { "field_reference": "business_proof_of_identification", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents", "status": "required", "reason_code": "document_missing" }, { "field_reference": "settlements.beneficiary_name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", "status": "required", "reason_code": "field_missing" }, { "field_reference": "settlements.account_number", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", "status": "required", "reason_code": "field_missing" }, { "field_reference": "settlements.ifsc_code", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", "status": "required", "reason_code": "field_missing" }, { "field_reference": "contact_name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", "status": "required", "reason_code": "field_missing" }, { "field_reference": "name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", "status": "required", "reason_code": "field_missing" }, { "field_reference": "customer_facing_business_name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", "status": "required", "reason_code": "field_missing" }, { "field_reference": "kyc.pan", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", "status": "required", "reason_code": "field_missing" } ], "tnc":{ "id": "tnc_IgohZaDBHRGjPv", "accepted": true, "accepted_at": 1641550798 }, "id": "acc_prd_HEgNpywUFctQ9e", "account_id": "acc_HQVlm3bnPmccC0", "product_name": "payment_gateway", "activation_status": "needs_clarification", "requested_at": 162547884 } ``` -------------------------------- ### Setup Razorpay Client Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/fund.md Initialize the Razorpay client with your API keys. This is required before making any API calls. ```ruby require "razorpay" Razorpay.setup('key_id', 'key_secret') ``` -------------------------------- ### Product Configuration Response Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/productConfiguration.md This is an example of the JSON response received after successfully editing a product configuration. ```json { "id": "acc_GP4lfNA0iIMn5B", "type": "standard", "status": "created", "email": "gauri@example.org", "profile": { "category": "healthcare", "subcategory": "clinic", "addresses": { "registered": { "street1": "507, Koramangala 1st block", "street2": "MG Road-1", "city": "Bengalore", "state": "KARNATAKA", "postal_code": "560034", "country": "IN" } } }, "notes": [], "created_at": 1610603081, "phone": "9000090000", "reference_id": "randomId", "business_type": "partnership", "legal_business_name": "Acme Corp", "customer_facing_business_name": "ABCD Ltd" } ``` -------------------------------- ### Setup Razorpay Client Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/addon.md Initialize the Razorpay client with your API key ID and secret. This must be done before making any API calls. ```ruby require "razorpay" Razorpay.setup('key_id', 'key_secret') ``` -------------------------------- ### Create Emandate Registration Link Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/emandate.md Use this to create a registration link for emandate setup. Ensure all required parameters like customer details, amount, currency, and subscription registration details are provided. ```ruby para_attr = { "customer": { "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "contact": 9123456780 }, "type": "link", "amount": 0, "currency": "INR", "description": "12 p.m. Meals", "subscription_registration": { "method": "emandate", "auth_type": "netbanking", "expire_at": 1580480689, "max_amount": 50000, "bank_account": { "beneficiary_name": "Gaurav Kumar", "account_number": 11214311215411, "account_type": "savings", "ifsc_code": "HDFC0001233" } }, "receipt": "Receipt no. #12", "expire_by": 1880480689, "sms_notify": 1, "email_notify": 1, "notes": { "note_key 1": "Beam me up Scotty", "note_key 2": "Tea. Earl Gray. Hot." } } Razorpay::SubscriptionRegistration.create(para_attr) ``` -------------------------------- ### Subscription Creation Response Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/subscriptions.md Example JSON response for a successfully created subscription. This includes details like ID, status, plan information, and billing cycle counts. ```json { "id": "sub_00000000000001", "entity": "subscription", "plan_id": "plan_00000000000001", "status": "created", "current_start": null, "current_end": null, "ended_at": null, "quantity": 1, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "charge_at": 1580453311, "start_at": 1580626111, "end_at": 1583433000, "auth_attempts": 0, "total_count": 6, "paid_count": 0, "customer_notify": true, "created_at": 1580280581, "expire_by": 1580626111, "short_url": "https://rzp.io/i/z3b1R61A9", "has_scheduled_changes": false, "change_scheduled_at": null, "source": "api", "offer_id":"offer_JHD834hjbxzhd38d", "remaining_count": 5 } ``` -------------------------------- ### Sample Account Document Response Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/account.md This is an example of the JSON response structure when fetching account documents. It lists the types and URLs of the documents. ```json { "business_proof_of_identification": [ { "type": "business_proof_url", "url": "" } ] } ``` -------------------------------- ### Order Creation Response JSON Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/registerEmandate.md This is an example of the JSON response received after successfully creating an order. It includes the order ID, status, and payment details. ```json { "id":"order_1Aa00000000002", "entity":"order", "amount":1000, "amount_paid":0, "amount_due":1000, "currency":"INR", "receipt":"Receipt No. 1", "offer_id":null, "status":"created", "attempts":0, "notes":{ "notes_key_1":"Tea, Earl Grey, Hot", "notes_key_2":"Tea, Earl Grey… decaf." }, "created_at":1579782776 } ``` -------------------------------- ### Payment Link Creation Response (JSON) Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/paymentLink.md This is an example of the JSON response received after successfully creating a payment link. It includes details about the payment link's ID, status, amount, customer information, and other configurable options. ```json { "accept_partial": true, "amount": 1000, "amount_paid": 0, "callback_method": "", "callback_url": "", "cancelled_at": 0, "created_at": 1596188371, "currency": "INR", "customer": { "contact": "+919999999999", "email": "gaurav.kumar@example.com", "name": "Gaurav Kumar" }, "deleted_at": 0, "description": "Payment for policy no #23456", "expire_by": 0, "expired_at": 0, "first_min_partial_amount": 100, "id": "plink_FL3YbdvN2Cj6gh", "notes": null, "notify": { "email": true, "sms": true }, "payments": null, "reference_id": "#543422", "reminder_enable": true, "reminders": [], "short_url": "https://rzp.io/i/wKiXKud", "source": "", "source_id": "", "status": "created", "updated_at": 1596188371, "user_id": "" } ``` -------------------------------- ### Create a Subscription Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/subscriptions.md Create a new subscription with specified plan details, quantity, and optional addons or notes. The `start_at` parameter is a Unix timestamp; if omitted, the subscription begins immediately after authorization. ```ruby para_attr = { "plan_id": "plan_7wAosPWtrkhqZw", "customer_notify": 1, "quantity": 5, "total_count": 6, "start_at": 1495995837, "addons": [ { "item": { "name": "Delivery charges", "amount": 30000, "currency": "INR" } } ], "notes": { "key1": "value3", "key2": "value2" } } Razorpay::Subscription.create(para_attr) ``` -------------------------------- ### Setup with Private Auth Source: https://github.com/razorpay/razorpay-ruby/blob/master/README.md Configure your Razorpay API key ID and secret for private authentication. This is typically done once during application setup. ```ruby Razorpay.setup('key_id', 'key_secret') ``` -------------------------------- ### Eligibility Check API Response Example Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/customer.md This is an example of the JSON response received after performing an eligibility check. It details the eligibility status for different payment instruments. ```json { "amount": "500000", "customer": { "id": "KkBhM9EC1Y0HTm", "contact": "+919999999999" }, "instruments": [ { "method": "emi", "issuer": "HDFC", "type": "debit", "eligibility_req_id": "elig_xxxxxxxxxxxxx", "eligibility": { "status": "eligible" } }, { "method": "paylater", "provider": "getsimpl", "eligibility_req_id": "elig_xxxxxxxxxxxxx", "eligibility": { "status": "eligible" } }, { "method": "paylater", "provider": "icic", "eligibility_req_id": "elig_xxxxxxxxxxxxx", "eligibility": { "status": "eligible" } }, { "method": "cardless_emi", "provider": "walnut369", "eligibility_req_id": "elig_xxxxxxxxxxxxx", "eligibility": { "status": "ineligible", "error": { "code": "GATEWAY_ERROR", "description": "The customer has not been approved by the partner.", "source": "business", "step": "inquiry", "reason": "user_not_approved" } } }, { "method": "cardless_emi", "provider": "zestmoney", "eligibility_req_id": "elig_xxxxxxxxxxxxx", "eligibility": { "status": "ineligible", "error": { "code": "GATEWAY_ERROR", "description": "The customer has exhausted their credit limit.", "source": "business", "step": "inquiry", "reason": "credit_limit_exhausted" } } }, { "method": "paylater", "provider": "lazypay", "eligibility_req_id": "elig_xxxxxxxxxxxxx", "eligibility": { "status": "ineligible", "error": { "code": "GATEWAY_ERROR", "description": "The order amount is less than the minimum transaction amount.", "source": "business", "step": "inquiry", "reason": "min_amt_required" } } } ] } ``` -------------------------------- ### Request Product Configuration - Ruby Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/productConfiguration.md Use this method to request a product configuration for your account. Ensure you accept terms and conditions by providing the `tnc_accepted` and `ip` parameters. ```ruby accountId = "acc_GP4lfNA0iIMn5B" Razorpay::Product.request_product_configuration(accountId, { "product_name": "payment_gateway", "tnc_accepted": true, "ip": "233.233.233.234" }) ``` -------------------------------- ### Order Fulfillment Response Example Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/order.md This is an example of the JSON response received after successfully updating order fulfillment details. It confirms the order ID and the updated fulfillment information. ```json { "entity": "order.fulfillment", "order_id": "EKwxwAgItXXXX", "payment_method": "upi", "shipping": { "waybill": "123456789", "status": "rto", "provider": "Bluedart" } } ``` -------------------------------- ### Stakeholder Creation Response Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/stakeholder.md This is an example of the JSON response received after successfully creating a stakeholder. ```json { "entity": "stakeholder", "relationship": { "director": true }, "phone": { "primary": "7474747474", "secondary": "7474747474" }, "notes": { "random_key_by_partner": "random_value" }, "kyc": { "pan": "AVOPB1111K" }, "id": "sth_GLGgm8fFCKc92m", "name": "Gaurav Kumar", "email": "gaurav.kumar@example.com", "percentage_ownership": 10, "addresses": { "residential": { "street": "506, Koramangala 1st block", "city": "Bengaluru", "state": "Karnataka", "postal_code": "560034", "country": "IN" } } } ``` -------------------------------- ### Create a Customer Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/customer.md Use this to create a new customer. You can specify details like name, email, contact, and GSTIN. Set `fail_existing` to `0` to allow duplicate entries. ```ruby Razorpay::Customer.create({ "name": "Gaurav Kumar", "contact": 9123456780, "email": "gaurav.kumar@example.com", "fail_existing": 0, "gstin": "29XAbbA4369J1PA", "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." } }) ``` -------------------------------- ### Fetch All Disputes Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/dispute.md Retrieves a list of all disputes associated with your account. This method can be used to get an overview of all ongoing or past disputes. ```APIDOC ## Fetch All Disputes ### Description Retrieves a list of all disputes associated with your account. ### Method GET (implied by SDK method) ### Endpoint /disputes ### Parameters None ### Request Example ```rb Razorpay::Dispute.all() ``` ### Response #### Success Response (200) Returns a collection of dispute objects. #### Response Example ```json { "entity": "collection", "count": 1, "items": [ { "id": "disp_Esz7KAitoYM7PJ", "entity": "dispute", "payment_id": "pay_EsyWjHrfzb59eR", "amount": 10000, "currency": "INR", "amount_deducted": 0, "reason_code": "pre_arbitration", "respond_by": 1590604200, "status": "open", "phase": "pre_arbitration", "created_at": 1590059211, "evidence": { "amount": 10000, "summary": null, "shipping_proof": null, "billing_proof": null, "cancellation_proof": null, "customer_communication": null, "proof_of_service": null, "explanation_letter": null, "refund_confirmation": null, "access_activity_log": null, "refund_cancellation_policy": null, "term_and_conditions": null, "others": null, "submitted_at": null } } ] } ``` ``` -------------------------------- ### Fetch Product Configuration - Ruby Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/productConfiguration.md Use this method to retrieve the configuration details for a specific product. Ensure you have the correct account ID and product ID. ```ruby accountId = "acc_GP4lfNA0iIMn5B" productId = "acc_prd_HEgNpywUFctQ9e" Razorpay::Product.fetch(accountId, productId) ``` -------------------------------- ### Create an Addon for a Subscription Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/addon.md Use this to add an extra item or service to an existing subscription. Specify the item details, currency, and quantity. ```ruby subscriptionId = "sub_JBELhNBHtTCyhh" Razorpay::Addon.create(subscriptionId,{ "item":{ "name":"Extra appala (papadum)", "amount":30000, "currency":"INR", "description":"1 extra oil fried appala with meals" }, "quantity":2 }) ``` -------------------------------- ### Get Access Token Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/oauth_token.md Obtain an access token by providing client credentials, redirect URI, authorization code, and grant type. ```APIDOC ## Get Access Token ### Description Obtain an access token using an authorization code. ### Method POST (Implied by SDK method) ### Endpoint Not explicitly defined, SDK method `Razorpay::OAuthToken.get_access_token` is used. ### Parameters #### Request Body Parameters - **client_id** (string) - Required - Unique client identifier. - **client_secret** (string) - Required - Client secret string. - **redirect_uri** (string) - Required - Specifies the same redirect_uri used in the authorisation request. - **grant_type** (string) - Required - Defines the grant type for the request. Possible values: `authorization_code`, `client_credentials`. - **code** (string) - Required - Decoded authorisation code received in the last step. Note: Pass this parameter only when grant_type is 'authorization_code'. - **mode** (string) - Optional - The type of mode. Possible values: `test`, `live` (default). ### Request Example ```ruby options = { 'client_id' => '', 'client_secret' => '', 'redirect_uri' => 'https://example.com/razorpay_callback', 'grant_type' => 'authorization_code', 'code' => '', 'mode' => 'test' } oauth_token = Razorpay::OAuthToken.get_access_token(options) ``` ### Response #### Success Response (200) - **public_token** (string) - The public token for the OAuth session. - **token_type** (string) - The type of token (e.g., 'Bearer'). - **expires_in** (integer) - The time in seconds until the token expires. - **access_token** (string) - The generated access token. - **refresh_token** (string) - The refresh token for obtaining new access tokens. - **razorpay_account_id** (string) - The Razorpay account ID associated with the token. #### Response Example ```json { "public_token": "rzp_test_oauth_9xu1rkZqoXlClS", "token_type": "Bearer", "expires_in": 7862400, "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6IkY1Z0NQYkhhRzRjcUpnIn0.eyJhdWQiOiJGNFNNeEgxanMxbkpPZiIsImp0aSI6IkY1Z0NQYkhhRzRjcUpnIiwiaWF0IjoxNTkyODMxMDExLCJuYmYiOjE1OTI4MzEwMTEsInN1YiI6IiIsImV4cCI6MTYwMDc3OTgxMSwidXNlcl9pZCI6IkYycVBpejJEdzRPRVFwIiwibWVyY2hhbnRfaWQiOiJGMnFQaVZ3N0lNV01GSyIsInNjb3BlcyI6WyJyZWFkX29ubHkiXX0.Wwqt5czhoWpVzP5_aoiymKXoGj-ydo-4A_X2jf_7rrSvk4pXdqzbA5BMrHxPdPbeFQWV6vsnsgbf99Q3g-W4kalHyH67LfAzc3qnJ-mkYDkFY93tkeG-MCco6GJW-Jm8xhaV9EPUak7z9J9jcdluu9rNXYMtd5qxD8auyRYhEgs", "refresh_token": "def50200f42e07aded65a323f6c53181d802cc797b62cc5e78dd8038d6dff253e5877da9ad32f463a4da0ad895e3de298cbce40e162202170e763754122a6cb97910a1f58e2378ee3492dc295e1525009cccc45635308cce8575bdf373606c453ebb5eb2bec062ca197ac23810cf9d6cf31fbb9fcf5b7d4de9bf524c89a4aa90599b0151c9e4e2fa08acb6d2fe17f30a6cfecdfd671f090787e821f844e5d36f5eacb7dfb33d91e83b18216ad0ebeba2bef7721e10d436c3984daafd8654ed881c581d6be0bdc9ebfaee0dc5f9374d7184d60aae5aa85385690220690e21bc93209fb8a8cc25a6abf1108d8277f7c3d38217b47744d7", "razorpay_account_id": "acc_Dhk2qDbmu6FwZH" } ``` ``` -------------------------------- ### Fetch a Particular Item Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/items.md Retrieve details for a specific item by providing its unique ID. This is useful for getting the most up-to-date information about an item. ```ruby itemId = "item_7Oxp4hmm6T4SCn" Razorpay::Item.fetch(itemId) ``` -------------------------------- ### Create a New Plan Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/plan.md Use this snippet to create a new plan with specified details like period, interval, item name, amount, currency, and optional notes. The item object contains details about the plan's offering. ```ruby para_attr = { "period": "weekly", "interval": 1, "item": { "name": "Test plan - Weekly", "amount": 69900, "currency": "INR", "description": "Description for the test plan" }, "notes": { "notes_key_1": "Tea, Earl Grey, Hot", "notes_key_2": "Tea, Earl Grey… decaf." } } Razorpay::Plan.create(para_attr) ``` -------------------------------- ### Request Product Configuration Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/productConfiguration.md Initiates a request for product configuration for a given account. This includes specifying the product name and accepting terms and conditions. ```APIDOC ## Request Product Configuration ### Description Initiates a request for product configuration for a given account. This includes specifying the product name and accepting terms and conditions. ### Method POST (Assumed based on typical API patterns for creation/request) ### Endpoint `/v1/accounts/{accountId}/products` (Assumed based on typical API patterns) ### Parameters #### Path Parameters - **accountId** (string) - Required - The ID of the account for which to request the product configuration. #### Request Body - **product_name** (string) - Required - The product(s) to be configured. Possible values: `payment_gateway`, `payment_links`. - **tnc_accepted** (boolean) - Optional - Pass this parameter to accept terms and conditions. Send this parameter along with the `ip` parameter when the tnc is accepted. Possible value: `true`. - **ip** (string) - Optional - The IP address of the merchant while accepting the terms and conditions. Send this parameter along with the `tnc_accepted` parameter when the `tnc` is accepted. ### Request Example ```rb accountId = "acc_GP4lfNA0iIMn5B" Razorpay::Product.request_product_configuration(accountId, { "product_name": "payment_gateway", "tnc_accepted": true, "ip": "233.233.233.234" }) ``` ### Response #### Success Response (200) - **requested_configuration** (object) - Details of the configuration that was requested. - **active_configuration** (object) - The currently active configuration for the account. - **requirements** (array) - A list of requirements or missing fields for the configuration. - **tnc** (object) - Information about the terms and conditions acceptance. - **id** (string) - The unique identifier for the requested product configuration. - **account_id** (string) - The ID of the account associated with this configuration. - **product_name** (string) - The name of the product configured. - **activation_status** (string) - The current activation status of the product. - **requested_at** (integer) - Timestamp when the configuration was requested. #### Response Example ```json { "requested_configuration": { "payment_methods": [] }, "active_configuration": { "payment_capture": { "mode": "automatic", "refund_speed": "normal", "automatic_expiry_period": 7200 }, "settlements": { "account_number": null, "ifsc_code": null, "beneficiary_name": null }, "checkout": { "theme_color": "#FFFFFF", "flash_checkout": true, "logo": "https://example.com/your_logo" }, "refund": { "default_refund_speed": "normal" }, "notifications": { "whatsapp": true, "sms": false, "email": [ "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com" ] }, "payment_methods": { "netbanking": { "enabled": true, "instrument": [ { "type": "retail", "bank": [ "hdfc", "sbin", "utib", "icic", "scbl", "yesb" ] } ] }, "wallet": { "enabled": true, "instrument": [ "airtelmoney", "freecharge", "jiomoney", "olamoney", "payzapp", "mobikwik" ] }, "upi": { "enabled": true, "instrument": [ "upi" ] } } }, "requirements": [ { "field_reference": "individual_proof_of_address", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", "status": "required", "reason_code": "document_missing" }, { "field_reference": "individual_proof_of_identification", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", "status": "required", "reason_code": "document_missing" }, { "field_reference": "business_proof_of_identification", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/documents", "status": "required", "reason_code": "document_missing" }, { "field_reference": "settlements.beneficiary_name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", "status": "required", "reason_code": "field_missing" }, { "field_reference": "settlements.account_number", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", "status": "required", "reason_code": "field_missing" }, { "field_reference": "settlements.ifsc_code", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/products/acc_prd_HEgNpywUFctQ9e", "status": "required", "reason_code": "field_missing" }, { "field_reference": "contact_name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", "status": "required", "reason_code": "field_missing" }, { "field_reference": "name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", "status": "required", "reason_code": "field_missing" }, { "field_reference": "customer_facing_business_name", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0", "status": "required", "reason_code": "field_missing" }, { "field_reference": "kyc.pan", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders", "status": "required", "reason_code": "field_missing" } ], "tnc":{ "id": "tnc_IgohZaDBHRGjPv", "accepted": true, "accepted_at": 1641550798 }, "id": "acc_prd_HEgNpywUFctQ9e", "account_id": "acc_HQVlm3bnPmccC0", "product_name": "payment_gateway", "activation_status": "needs_clarification", "requested_at": 162547884 } ``` ``` -------------------------------- ### Setup with OAuth Access Token Source: https://github.com/razorpay/razorpay-ruby/blob/master/README.md Configure your Razorpay access token for OAuth authentication. This method is used when integrating with Razorpay via OAuth. ```ruby Razorpay.setup_with_oauth('access_token') ``` -------------------------------- ### Create Customer Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/registerNach.md Use this snippet to create a new customer with their details. Ensure all required parameters like name, contact, and email are provided. ```ruby para_attr = { "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." } } Razorpay::Customer.create(para_attr) ``` -------------------------------- ### Get Access Token using Refresh Token Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/oauth_token.md Refresh an expired access token by providing client credentials and a valid refresh token. ```APIDOC ## Get Access Token using Refresh Token ### Description Obtain a new access token by using a previously issued refresh token. ### Method POST (Implied by SDK method) ### Endpoint Not explicitly defined, SDK method `Razorpay::OAuthToken.refresh_token` is used. ### Parameters #### Request Body Parameters - **client_id** (string) - Required - Unique client identifier. - **client_secret** (string) - Required - Client secret string. - **refresh_token** (string) - Required - The previously-stored refresh token value. ### Request Example ```ruby options = { 'client_id' => '', 'client_secret' => '', 'refresh_token' => 'def5020096e1c470c901d34cd60fa53abdaf3662sa0' } oauth_token = Razorpay::OAuthToken.refresh_token(options) ``` ### Response #### Success Response (200) - **public_token** (string) - The public token for the OAuth session. - **token_type** (string) - The type of token (e.g., 'Bearer'). - **expires_in** (integer) - The time in seconds until the token expires. - **access_token** (string) - The newly generated access token. - **refresh_token** (string) - The new refresh token (may be the same or a new one). #### Response Example ```json { "public_token": "rzp_test_oauth_9xu1rkZqoXlClS", "token_type": "Bearer", "expires_in": 7862400, "access_token": "eyJ0eXAiOiJKV1QiLCJhbGciOiJSUzI1NiIsImp0aSI6Ijl4dTF", "refresh_token": "def5020096e1c470c901d34cd60fa53abdaf36620e823ffa53" } ``` ``` -------------------------------- ### Add Razorpay Gem to Gemfile Source: https://github.com/razorpay/razorpay-ruby/blob/master/README.md To use the Razorpay Ruby gem, add it to your application's Gemfile. After adding, run `bundle install`. ```ruby gem 'razorpay' ``` -------------------------------- ### Fetch a product configuration Source: https://github.com/razorpay/razorpay-ruby/blob/master/documents/productConfiguration.md Retrieves the configuration details for a given product ID within a specific account ID. This includes active configurations, requested configurations, and any outstanding requirements. ```APIDOC ## Fetch a product configuration ### Description Retrieves the configuration details for a specific product associated with a sub-merchant account. This includes active configurations, requested configurations, and any outstanding requirements. ### Method POST ### Endpoint /v1/product_configurations/{accountId}/{productId} ### Parameters #### Path Parameters - **accountId** (string) - Required - The unique identifier of a sub-merchant account generated by Razorpay. - **productId** (string) - Required - The unique identifier of a product generated by Razorpay. ### Response #### Success Response (200) - **id** (string) - The unique identifier of the product configuration. - **account_id** (string) - The unique identifier of the associated sub-merchant account. - **product_name** (string) - The name of the product. - **activation_status** (string) - The current activation status of the product configuration. - **requested_at** (integer) - Timestamp when the configuration was requested. - **tnc** (object) - Terms and conditions details. - **id** (string) - The ID of the terms and conditions. - **accepted** (boolean) - Indicates if the terms and conditions were accepted. - **accepted_at** (integer) - Timestamp when the terms and conditions were accepted. - **requested_configuration** (object) - Details of the configuration that was requested. - **payment_methods** (array) - List of payment methods requested. - **active_configuration** (object) - Details of the currently active configuration. - **payment_capture** (object) - Settings for payment capture. - **mode** (string) - The mode of payment capture (e.g., 'automatic'). - **refund_speed** (string) - The speed of refunds. - **automatic_expiry_period** (integer) - The automatic expiry period in seconds. - **settlements** (object) - Settlement details. - **account_number** (string or null) - The settlement account number. - **ifsc_code** (string or null) - The settlement IFSC code. - **beneficiary_name** (string or null) - The settlement beneficiary name. - **checkout** (object) - Checkout settings. - **theme_color** (string) - The theme color for checkout. - **flash_checkout** (boolean) - Whether flash checkout is enabled. - **refund** (object) - Refund settings. - **default_refund_speed** (string) - The default refund speed. - **notifications** (object) - Notification settings. - **whatsapp** (boolean) - Whether WhatsApp notifications are enabled. - **sms** (boolean) - Whether SMS notifications are enabled. - **email** (array) - List of email addresses for notifications. - **payment_methods** (object) - Enabled payment methods and their instruments. - **netbanking** (object) - Netbanking configuration. - **enabled** (boolean) - Whether netbanking is enabled. - **instrument** (array) - List of netbanking instruments. - **type** (string) - The type of instrument. - **bank** (array) - List of supported banks. - **wallet** (object) - Wallet configuration. - **enabled** (boolean) - Whether wallets are enabled. - **instrument** (array) - List of supported wallet instruments. - **upi** (object) - UPI configuration. - **enabled** (boolean) - Whether UPI is enabled. - **instrument** (array) - List of UPI instruments. - **requirements** (array) - List of outstanding requirements for the product configuration. - **field_reference** (string) - The reference to the field that has a requirement. - **resolution_url** (string) - The URL to resolve the requirement. - **status** (string) - The status of the requirement (e.g., 'required'). - **reason_code** (string) - The reason code for the requirement. ### Request Example ```json { "accountId": "acc_GP4lfNA0iIMn5B", "productId": "acc_prd_HEgNpywUFctQ9e" } ``` ### Response Example ```json { "requested_configuration": { "payment_methods": [] }, "active_configuration": { "payment_capture": { "mode": "automatic", "refund_speed": "normal", "automatic_expiry_period": 7200 }, "settlements": { "account_number": null, "ifsc_code": null, "beneficiary_name": null }, "checkout": { "theme_color": "#FFFFFF", "flash_checkout": true }, "refund": { "default_refund_speed": "normal" }, "notifications": { "whatsapp": true, "sms": false, "email": [ "b963e252-1201-45b0-9c39-c53eceb0cfd6_load@gmail.com" ] }, "payment_methods": { "netbanking": { "enabled": true, "instrument": [ { "type": "retail", "bank": [ "hdfc", "sbin", "utib", "icic", "scbl", "yesb" ] } ] }, "wallet": { "enabled": true, "instrument": [ "airtelmoney", "freecharge", "jiomoney", "olamoney", "payzapp", "mobikwik" ] }, "upi": { "enabled": true, "instrument": [ "upi" ] } } }, "requirements": [ { "field_reference": "individual_proof_of_address", "resolution_url": "/accounts/acc_HQVlm3bnPmccC0/stakeholders/{stakeholderId}/documents", "status": "required", "reason_code": "document_missing" } ], "tnc":{ "id": "tnc_IgohZaDBHRGjPv", "accepted": true, "accepted_at": 1641550798 }, "id": "acc_prd_HEgNpywUFctQ9e", "account_id": "acc_HQVlm3bnPmccC0", "product_name": "payment_gateway", "activation_status": "needs_clarification", "requested_at": 1625478849 } ``` ```