Available in🇮🇳 India
Once you capture a payment, Razorpay Checkout returns a razorpay_payment_id. You can use this id to fetch the token_id, which is used to create and charge subsequent payments.
You can retrieve the token_id using the Dashboard or the APIs given below.
2.1. What is a Token?
A recurring token represents a mandate registration and is generated after the authorisation transaction is successfully captured. A recurring token contains the customer’s payment details stored by Razorpay and is used to create a recurring payment. For simplicity, recurring tokens are considered to be mandates. Hence, the status of the recurring token determines the status of the mandate registration.2.2. Token States
As the authorisation transaction moves through its states, the token generated for the mandate also changes state.
Only tokens in the
confirmed state can be used to create subsequent payments. Paper NACH tokens do not have a paused state.
2.3. Fetch Payment ID using Order ID
After you send the registration link, You should wait for the customer to make the payment. You can check the status of the payment using our APIs. The following endpoint fetches thepayment_id using an order_id.
GET /orders/:id/payments
Path Parameter
id
: string The unique identifier of the order. For example, order_1Aa00000000001.
2.4. Fetch Token by Payment ID
Use the below endpoint to fetch thetoken_id using a payment_id.
GET /payments/:id
Handy TipsYou can also retrieve the
token_id via the payment.authorized webhook.Path Parameter
id mandatory
: string The unique identifier of the payment to be retrieved. For example, pay_1Aa00000000002.
2.5. Fetch Tokens by Customer ID
Use the below endpoint to fetch tokens linked to a customer. A customer can have multiple tokens tied to them. These tokens can be used to create subsequent payments for multiple products or services.GET /customers/:id/tokens
Path Parameters
id mandatory
: string The unique identifier of the customer for whom tokens are to be retrieved. For example, cust_1Aa00000000002.
2.6. Delete Tokens
The following endpoint deletes a token.DELETE /customers/:customer_id/tokens/:token_id
Path Parameter
customer_id mandatory
: string The unique identifier of the customer with whom the token is linked. For example, cust_1Aa00000000002.
token_id mandatory
: string The unique identifier of the token that is to be deleted. For example, token_1Aa00000000001.
2.7. Error Scenarios
If a token request fails, the API response carries an error object withcode, description, source, step and reason. Use the reason to decide the next action. For the Paper NACH error reasons, see Error Codes.