Update
Your $response
is already an object, therefore this expression should work:
if ($response->response->success == true) {
// etc
}
Are you just looking for code that decodes the string representation? If so:
$response = <<<'EOM'
{
"response": {
"token": "ch_lfUYEBK14zotCTykezJkfg",
"success": true,
"amount": 400,
"currency": null,
"description": "test charge",
"email": "user@user.com",
"ip_address": "203.192.1.172",
"created_at": "2012-06-20T03:10:49Z",
"status_message": "Success!",
"error_message": null,
"card": {
"token": "card_nytGw7koRg23EEp9NTmz9w",
"display_number": "XXXX-XXXX-XXXX-0000",
"scheme": "master",
"address_line1": "42 Sevenoaks St",
"address_line2": null,
"address_city": "Lathlain",
"address_postcode": "6454",
"address_state": "WA",
"address_country": "Australia"
},
"transfer": null
}
}
EOM;
$responseData = json_decode($responseText, true);
if ($responseData['response']['success'] == true) {
// continue transaction
}