I get an HTTP message with the following JSON object:
{"notification":{"version":6.0,"attemptCount":0,"role":"VENDOR","site":"nicholeen","receipt":"********","currency":"USD","transactionType":"TEST","transactionTime":1406070122781,"paymentMethod":"VISA","totalProductAmount":1.00,"totalTaxAmount":0.00,"totalShippingAmount":0.00,"customer":{"shipping":{"firstName":"TEST","lastName":"USER","fullName":"Test User","email":"testuser@somesite.com","address":{}},"billing":{"firstName":"TEST","lastName":"USER","fullName":"Test User","email":"testuser@somesite.com","address":{}}},"lineItems":[{"itemNo":"1","productTitle":"A passed in title","shippable":false,"recurring":false,"customerProductAmount":1.00,"customerTaxAmount":0.00}]},"verification":"2745A502"}
I need to convert the notification JSON object to the JSON string assigned to the PHP variable, without losing any data, including decimal numbers.
I am currently getting IPN using $ipn_raw = file_get_contents('php://input');. Then I json_decode JSON into a PHP variable and then re-encode the notification part with json_encode. Here is the code:
$ipn_raw = file_get_contents('php://input');
$ipn = json_decode($ipn_raw);
$notification = $ipn['notification'];
$result = json_encode($notification);
However, the result breaks up some values giving me the following:
{"version":6,"attemptCount":0,"role":"VENDOR","site":"nicholeen","receipt":"********","currency":"USD","transactionType":"TEST","transactionTime":1406095846441,"paymentMethod":"VISA","totalProductAmount":1,"totalTaxAmount":0,"totalShippingAmount":0,"customer":{"shipping":{"firstName":"TEST","lastName":"USER","fullName":"Test User","email":"testuser@somesite.com","address":[]},"billing":{"firstName":"TEST","lastName":"USER","fullName":"Test User","email":"testuser@somesite.com","address":[]}},"lineItems":[{"itemNo":"1","productTitle":"A passed in title","shippable":false,"recurring":false,"customerProductAmount":1,"customerTaxAmount":0}]}
You can see that version 6.0 is now only version 6, totalProductAmount was 1.00 and now 1, etc.
How can I do this without changing the values as a result?
Thank!
, , . Clickbank , SHA 1, IP- 6 (. https://support.clickbank.com/entries/22803622-Instant-Notification-Service)
1) JSON/DSL JSON "" IPN.
2) JSON "" JSON. { }, JSON.
3) . .
4) SHA 1 -, 3.
5) 8 , 4. "" IP- v6.
, , , - .