Custom – UPI QR

Builds PgPayRequest with UPI QR as the payment instrument.

Instrument Parameters

buildUpiQrInstrument method from class InstrumentBuilder function directly returns the Instrument Object and no need to call the build() method on it.

Example (Custom – UPI QR)

const $MERCHANTID="<merchantId>"; const $SALTKEY="<saltKey>"; const $SALTINDEX="<saltIndex>"; const $env=Env::UAT; const $SHOULDPUBLISHEVENTS=true; $phonePePaymentsClient = new PhonePePaymentClient(MERCHANTID, SALTKEY, SALTINDEX, Env::UAT, SHOLDPUBLISHEVENTS); $merchantTransactionId = "merchantTransactinoId"; $request = PgPayRequestBuilder::builder() ->mobileNumber("9090909090") ->callbackUrl("https://webhook.in/test ") ->merchantId(MERCHANTID) ->merchantUserId("<merchantUserId>") ->amount(<amountInPaise>) ->merchantTransactionId($merchantTransactionId) ->paymentInstrument(InstrumentBuilder::buildUpiQrInstrument()) ->build(); $response = $phonePePaymentsClient->pay($request); $imageBase64Data = $response->getInstrumentResponse()->getQrData(); $intentUrl = $response->getInstrumentResponse()->getIntentUrl();