Display PhonePe Profile

Server Side

  1. Save the below assigned value at your server
Java
String apiEndPoint = "/v3/profile"; // Discuss with PhonePe team regarding this
  1. Construct the request body and encode in Base 64 as follows:
Java
HashMap<String, Object> data = new HashMap<>(); data.put("merchantId", <Your merchant ID>); // Mandatory data.put("transactionId", <Unique transaction id>); // Mandatory data.put("merchantUserId", userId); // Mandatory. Needed for linking data.put("mobileNumber", <Mobile number of the user>); // Optional data.put("email", <Email of the user>); // Optional data.put("shortName", <Name of the user>); // Optional // Put more info as intimated. Nesting is allowed String base64Body = Base64(new GSON().toJson(data));
  1. Select one of the salts shared with you and note its index. Construct Checksum as follows:
Java
String checksum = sha256(base64Body + apiEndPoint + salt) + ### + saltIndex;

App Side

  1. Collect Base64 encoded body, checksum, apiEndPoint and transactionID from your server using an API call.
  2. Initiate the process to show profile as follows:
Swift
let profileRequest = PPSTransactionRequest( base64EncodedBody: <#body received by your server#>, apiEndPoint: <#apiEndPoint received by your server#>, checksum: <#checksum received by your server#>) PhonePeSDK.shared().startPhonePeTransactionRequest(profileRequest, on: self, animated: true) { (request, result) in //Do something with the request/result } //If you get any error, refer to the iOS Merchant Integration Document section troubleshoot for the steps to debug.
Objective-C
PPSTransactionRequest * profileRequest = [[PPSTransactionRequest alloc] initWithBase64EncodedBody:<#body received by your server#> apiEndPoint:<#apiEndPoint received by your server#> checksum:<#checksum received by your server#>]; [[PhonePeSDK shared] startPhonePeTransactionRequest:profileRequest onViewController:self animated:YES completion:^(PPSTransactionRequest * request, PPSTransactionCompletionResult * result) { //Do something with request/result }]; //If you get any error, refer to the iOS Merchant Integration Document section troubleshoot for the steps to debug.