UPI INTENT
Request Details
| 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 |
Example : iOS
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
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"
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)
custom_checkout_pay_response = custom_checkout_client.pay(custom_checkout_pay_request)
intent_url = custom_checkout_pay_response.intent_urlExample : Android
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
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 = "ANDROID"
target_app = "com.phonepe.app"
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)
custom_checkout_pay_response = custom_checkout_client.pay(custom_checkout_pay_request)
intent_url = custom_checkout_pay_response.intent_urlExtract the intent_url from the response received.
Response Details
| 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 |