- Save the below assigned value at your server
String apiEndPoint = "/v3/profile"; // Discuss with PhonePe team regarding this
- Construct the request body and encode in Base 64 as follows:
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));
- Select one of the salts shared with you and note its index. Construct Checksum as follows:
String checksum = sha256(base64Body + apiEndPoint + salt) + ### + saltIndex;
- Collect Base64 encoded body, checksum, apiEndPoint and
transactionID
from your server using an API call. - Initiate the process to show profile as follows:
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.
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.