Page 1 of 1

Google InApp Payments

Posted: Sun Sep 02, 2012 4:40 pm
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.

Re: Google InApp Payments

Posted: Tue Sep 04, 2012 12:23 pm
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.