Search code examples
iosreact-nativein-app-purchase

How to associate apple payment notification with my custom payment records?


I want to add subscriptions to my app. I already have in-app-purchase working but I have a problem: the server-to-server payment notification have no data related to my system, so I don't know which record I have to update when notification arrives.

I'm trying to follow this.

I want a flow like this image but I can't find some param in the payment API that allows me to add a bill_id.

desired flow


Solution

  • finally, you can't add your custom key to the payment process (like others payment gateways allows), you have to associate the receipt to your system to track the user's bill. You have to use the validate receipt Apple's api to consider the payment done and valid. So the payment process is sync, you haven't to wait any notification to consider the payment done, but you have to listen notifications to get notified when a subscription is canceled or renewed. Here is a graphic of the solution.

    the f*#! solution