Brian Rak
Brian Rak

Reputation: 5124

Is there any way to create a sandox-specific shared secret for Apple App Store receipt validation?

I'm getting set up to do validations of App Store in-app purchase receipts from my server, and everything seems to be working fine, except I don't see any way to create separate shared secrets for Apple's Sandbox and Production environments.

I'd like the shared secrets to be separate so that I can safely put the Sandbox one in config files in code repositories, for unit tests, for example. I would keep the Production shared secret only in the config files in our Production environment.

I can't seem to find any way to do this. Am I just missing something?

Upvotes: 7

Views: 439

Answers (1)

AliRehman7141
AliRehman7141

Reputation: 993

App secret works for both sandbox or production the thing which changes the environment for testing is URL try this.

#if DEBUG
    let urlString = "https://sandbox.itunes.apple.com/verifyReceipt"
#else 
    let urlString = "https://buy.itunes.apple.com/verifyReceipt"
#endif

Upvotes: 0

Related Questions