Tuesday 15 March 2011

php - Stripe Plans JSON string formatting -



php - Stripe Plans JSON string formatting -

when read plans stripe api i'm getting below response

stripe_list json: { "object": "list", "has_more": false, "url": "\/v1\/plans", "data": [ { "id": "999999999", "interval": "month", "name": "10mb \/ month", "created": 1409893899, "amount": 9900, "currency": "usd", "object": "plan", "livemode": false, "interval_count": 1, "trial_period_days": null, "metadata": [], "statement_description": "inc" } ] }

how can remove stripe_list json: response.

here php code

function getallplans(){ require_once('./stripe-php/lib/stripe.php'); stripe::setapikey($this->apikey); homecoming stripe_plan::all(); }

here code calling function

echo $objstripe->getallplans();

according comment, using:

echo $objstripe->getallplans();

your getallplans() method returns associative array , can't echo array.

assuming want json, should use:

echo json_encode($objstripe->getallplans()); exit;

that encode associative array json string can pass android application.

php stripe-payments

No comments:

Post a Comment