Advertisement
Guest User

Untitled

a guest
Feb 21st, 2017
79
0
Never
Not a member of Pastebin yet? Sign Up, it unlocks many cool features!
text 1.18 KB | None | 0 0
  1. iap.config({
  2. googlePublicKeyStrSandBox: googlePublicKeyStrSandBox,
  3. googlePublicKeyStrLive: googlePublicKeyStrLive,
  4. googleAccToken: googleAccToken,
  5. googleRefToken: googleRefToken,
  6. googleClientID: googleClientID,
  7. googleClientSecret: googleClientSecret
  8. });
  9.  
  10. iap.setup((err) => {
  11. if (err) {
  12. full = { messageText: 'Failed: Invalid In-app purchase set up', category:'ProcessSubscriptionGoogle'}
  13. callback(null, full);
  14. } else {
  15. // refresh token before validating the receipt
  16. iap.refreshGoogleToken( function (err, response) {
  17. if (err) {
  18. full = { messageText: 'Failed: Cannot Refresh Token', category:'ProcessSubscriptionGoogle'}
  19. callback(null, full);
  20. } else {
  21. iap.validate(validationType, googleReceipt, (err, response) => {
  22. if (err) {
  23. full = { messageText: 'Failed: Invalid Receipt', category:'ProcessSubscriptionGoogle'}
  24. callback(null, full);
  25. } else {
  26. console.log(response);
  27. }
  28. });
  29. }
  30. })
  31. }
  32. });
Advertisement
Add Comment
Please, Sign In to add comment
Advertisement