UPI COLLECT

Request Details

Parameter NameData TypeMandatoryDescription
merchantOrderIdStringyesUnique order ID generated by merchant
amountlongyesAmount of order in Paisa
contraintsListyesDifferent type of constraints that must be applied to the payment
VPAStringYesVPA against which collect request need to be raised

Example :

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
vpa = "<REPLACE_WITH_REQUIRED_VPA>"
collect_message = "<MESSAGE_DISPLAYED_TO_USER>"
custom_checkout_pay_request = PgPaymentRequest.build_upi_collect_pay_via_vpa_request(vpa=vpa,
                                                                                               amount=amount,
                                                                                               merchant_order_id=merchant_order_id,
                                                                                               message=collect_message)
 
custom_checkout_pay_response = custom_checkout_client.pay(custom_checkout_pay_request)

The function will raise the collect request to the above mentioned VPA.

Response Details

PropertyTypeDescription
orderIdStringOrder Id created by PhonePe
stateStringState of the order. Initially it will be PENDING.
expireAtLongOrder expire date in epoch
Is this article helpful?