PhonePe / phonepe-pg-sdk-flutter

12 stars 7 forks source link

How to integrate with Backend Server? #16

Closed aradhya2211 closed 7 months ago

aradhya2211 commented 7 months ago

There's no clarity on the flow of the payments using SDK. Currently we have integrated phonePe, using the following flow:

Flutter Client -> our backend -> pp backend (PAY API) -> return payment url -> redirect client to payment url -> wait for webhook/recon process -> check status API -> show result to user

But with SDK what will be the flow to securely integrate with our backend server?

If there's any link to this flow or documentation pls share. As I didn't find anything on phone pe docs..

NitinVermaPpe commented 7 months ago

hey you can reach out to merchant-integration@phonepe.com to understand the flow.

but I do agree with your concern. For now, I have made below diagram. Let me know if you have any feedback on this. we will soon publish it on our dev docs

Screenshot 2024-04-12 at 4 51 36 PM
aradhya2211 commented 7 months ago

Thanks for sharing the flow, is it safe to send base64/encoded data back to the client? I highly recommend you not to discontinue the Pay API.. instead return a masked token which can be passed to the SDK!

NitinVermaPpe commented 7 months ago

yes it is safe to pass base64 back to the client. for data integrity, we will check the checksum

aradhya2211 commented 7 months ago

Okay thanks.. flow will be same for flutter web right?

NitinVermaPpe commented 7 months ago

wherever you are using sdk, above shared flow will work. https://github.com/PhonePe/phonepe-pg-sdk-flutter/issues/16#issuecomment-2051571007

for sdk-less integration, you have already mentioned the flow in the issue. https://github.com/PhonePe/phonepe-pg-sdk-flutter/issues/16#issue-2238962979