Skip to content
Merged
Show file tree
Hide file tree
Changes from all commits
Commits
File filter

Filter by extension

Filter by extension

Conversations
Failed to load comments.
Loading
Jump to
Jump to file
Failed to load files.
Loading
Diff view
Diff view
180 changes: 180 additions & 0 deletions documents/payment.md
Original file line number Diff line number Diff line change
Expand Up @@ -438,6 +438,186 @@ 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:** <br>
```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:** <br>
```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:** <br>
```json
{
"razorpay_payment_id": "pay_CMeM6XvOPGFiF",
"link": "upi://pay?pa=success@razorpay&pn=xyz&tr=xxxxxxxxxxx&tn=gourav&am=1&cu=INR&mc=xyzw"
}
```
-------------------------------------------------------------------------------------------------------

### 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:** <br>
```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:** <br>
please refer this [doc](https://razorpay.com/docs/payments/third-party-validation/s2s-integration/methods-api/#fetch-payment-methods) for response

```
-------------------------------------------------------------------------------------------------------

**PN: * indicates mandatory fields**
<br>
<br>
Expand Down
27 changes: 27 additions & 0 deletions razorpay/resources/payment.py
Original file line number Diff line number Diff line change
Expand Up @@ -223,3 +223,30 @@ 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)