Standard – Pay Page

This method is used to initiate a payment via the PhonePe PG Standard Checkout

Parameters

ParameterTypeMandatoryDescription
merchant_transaction_idstrYesThe unique transaction ID assigned by the merchant.
Note:
– merchantTransactionId length should be less than 35 characters
– No Special characters allowed except underscore “_” and hyphen “-“
amountintYesThe amount of the payment. In paise. Minimum 100 i.e. 1 rupee
merchant_user_idstrYesThe ID assigned to the user by the merchant.
Note:
– merchantUserId length should be less than 36 characters
– No Special characters allowed except underscore “_” and hyphen “-“
redirect_urlstrYesThe UI URL to redirect the user after a successful payment.
redirect_modestrYesThe mode of redirection after payment completion.
callback_urlstrYesThe S2S callback URL to which status notifications will be sent.
callback_modestrYesThe mode of callback handling.
merchant_order_idstrNoThe ID of the order assigned by the merchant.

For Python SDK Version <= 0.0.3, the imports should be:
from phonepe.sdk.pg.payments

For Python SDK Version > 0.0.3, the imports should be:
from phonepe.sdk.pg.payments.v1

Example (Pay Page)

import uuid  
from phonepe.sdk.pg.payments.v1.models.request.pg_pay_request import PgPayRequest
from phonepe.sdk.pg.payments.v1.payment_client import PhonePePaymentClient
from phonepe.sdk.pg.env import Env

merchant_id = "<YOUR_MERCHANT_ID>"  
salt_key = "<YOUR_SALT_KEY>"  
salt_index = 1 # Updated with your Salt Index  
env = Env.UAT  
should_publish_events = True  
phonepe_client = PhonePePaymentClient(merchant_id, salt_key, salt_index, env, should_publish_events)

unique_transcation_id = str(uuid.uuid4())[:-2]
ui_redirect_url = "https://www.merchant.com/redirectPage"  
s2s_callback_url = "https://www.merchantBackend.com/backendCallbackHandler"  
amount = 100  # 1 rupee, 100 paise  
id_assigned_to_user_by_merchant = "YOUR_USER_ID"  
pay_page_request = PgPayRequest.pay_page_pay_request_builder(merchant_transaction_id=unique_transcation_id,  
                                                             amount=amount,  
                                                             merchant_user_id=id_assigned_to_user_by_merchant,  
                                                             callback_url=s2s_callback_url,  
                                                             redirect_url=ui_redirect_url)  
pay_page_response = phonepe_client.pay(pay_page_request)  
pay_page_url = pay_page_response.data.instrument_response.redirect_info.url

Returns

The function returns a PhonePeResponse object with the following properties:

ParameterTypeDescription
successbooleanSuccess/failure of the request processing
codestrResponse code explaining the result
messagestrAdditional information about the response
dataPgPayResponseAvailable payment options

PgPayResponse properties

Here is the response property table for the given model:

PropertyTypeDescription
merchant_idstrThe ID of the merchant associated with the transaction.
merchant_transaction_idstrThe unique identifier of the merchant transaction.
transaction_idstrThe unique identifier of the transaction.
instrument_responseAnyInstrument data based on request.