Google InApp Payments

Ask about a PHP problem here.
Post Reply
bowersbros
Posts: 534
Joined: Thu May 05, 2011 8:19 pm

Google InApp Payments

Post by bowersbros »

I am trying to process an inapp request for Google Wallet (so that its instant rather than google checkout which takes longer)

The processing (in terms of charging the user) works perfectly. However, I can't seem to process the actual postback.

https://developers.google.com/in-app-pa ... s/postback

Thats the docs page, and this is my code:

[syntax=php]<?php
require('../jwt.php');
$response = isset($HTTP_RAW_POST_DATA) ? $HTTP_RAW_POST_DATA : file_get_contents('php://input');
$response = substr_replace($response, "",0,4);
$response = JWT::decode($response, '***Va_Q');
file_put_contents('jwt_decode.txt',$response);
print_r($response->response);
?>[/syntax]

The file_put_contents() is supposed to tell me the structure so that I can use it properly, however It gives me 0 bytes.

I think i can do it as $response->request->price etc, but I'd like to get a full idea of how it is structured.

Thanks

Alex.
Nb. JWT:: class is a downloaded one, and it works fine. It is the one recommended to be used by Google, so that isn't the issue.
Also, the $response->response does work, as Google accept the 200 call back to their server, which initiates the payment process.
I don't like to brag, but I wasn't circumcised. I was circumnavigated. ;)

Want to learn something new? Or maybe reinforce what you already know? Or just help out? Please subscribe to my videos: http://goo.gl/58pN9
User avatar
jacek
Site Admin
Posts: 3262
Joined: Thu May 05, 2011 1:45 pm
Location: UK
Contact:

Re: Google InApp Payments

Post by jacek »

I think you just need to move line 6 above line 5 ? you want to write the actual response to the file not the object.
Image
Post Reply