UPI INTENT
Request
| Parameter Name | Data Type | Mandatory | Description |
|---|---|---|---|
merchantOrderId | String | yes | Unique order ID generated by merchant |
amount | long | yes | Amount of order in Paisa |
contraints | List | yes | Different type of constraints that must be applied to the payment |
deviceOS | String | no | Operating system of the device. Allowed values are: 1. IOS 2. ANDROID |
merchantCallbackScheme | String | no | Required only in case targetApp = PHONEPE and deviceOS = IOS |
targetApp | String | no | The target app identifier for the UPI Intent flow. For IOS: PHONEPE, GPAY, PAYTM. For Android: com.phonepe.app, net.one97.paytm |
Sample Request
import uuid
from phonepe.sdk.pg.payments.v2.custom_checkout_client import CustomCheckoutClient
from phonepe.sdk.pg.env import Env
from phonepe.sdk.pg.common.models.request.pg_payment_request import PgPaymentRequest
from phonepe.sdk.pg.common.models.request.meta_info import MetaInfo
client_id = "<client_id>"
client_secret = "<client_secret>"
client_version = 1 # insert your client version here
env = Env.SANDBOX # change to Env.PRODUCTION when you go live
custom_checkout_client = CustomCheckoutClient.get_instance(client_id=client_id,
client_version=client_version,
client_secret=client_secret,
env=env)
merchant_order_id = str(uuid.uuid4())
amount = 100
device_os = "IOS"
target_app = "PHONEPE"
meta_info = MetaInfo() \
.udf1("free-text-value-1") \
.udf2("free-text-value-2") \
.udf3("free-text-value-3") \
.udf4("free-text-value-4") \
.udf5("free-text-value-5") \
.udf6("free-text-value-6") \
.udf7("free-text-value-7") \
.udf8("free-text-value-8") \
.udf9("free-text-value-9") \
.udf10("free-text-value-10") \
.udf11("ref_11") \
.udf12("tag-12") \
.udf13("user@13") \
.udf14("code.14") \
.udf15("val+15") \
.build()
custom_checkout_pay_request = PgPaymentRequest.build_upi_intent_pay_request(
merchant_order_id=merchant_order_id,
amount=amount,
target_app=target_app,
device_os=device_os,
meta_info=meta_info)
custom_checkout_pay_response = custom_checkout_client.pay(custom_checkout_pay_request)
intent_url = custom_checkout_pay_response.intent_url
Response
Extract the intent_url from the response received.
| Property | Type | Description |
|---|---|---|
orderId | String | Order Id created by PhonePe |
state | String | State of the order. Initially it will be PENDING. |
expireAt | Long | Order expire date in epoch |
IntentUrl | String | Intent url according to the targetApp mentioned in the request |