Usage with Cordova

Using the receipt validator with the cordova purchase plugin is as simple as adding a single line in your code at plugin initialization.

store.validator =

Note: Replace <PUBLIC_KEY> and <APP_NAME> with values from your account.

Your account on needs to be configured correctly for the platforms you intend to use (shared key on iOS, license key on Android, etc).

Enabling Validation

Receipt validation is being called when you do p.verify(). Some demo code omit this line, so make sure that p.verify() is called from the approved event, then p.finish() called from the verified event.

  .approved(p => p.verify())
  .verified(p => p.finish());

You might have to edit your existing handlers for approved events to make sure it doesn't call p.finish() but p.verify()

Security Policy

Depending on how your app is configured, security policy may prevent you to make requests to the validation service (DOM Exception 18 / Error 0). To prevent this, it make sure is listed in your HTML file’s meta "Content-Security-Policy", in the "connect-src" list.

Here’s an example of what that looks like:

<meta http-equiv="Content-Security-Policy"
  content="default-src 'self' 'unsafe-eval'; connect-src; style-src 'self' 'unsafe-inline'; media-src *">

Need Help?

Contact us!