I can’t figure it out. So what I do is there is an automatic payment page. The client performs autopopulation, and the php script will create a subscription with a strip. I cannot figure out how to get this subscription id to save it on my db. Here is what I have:
$cu = Stripe_Customer::retrieve("$stripename");
$cu->subscriptions->create(array("plan" => "cocacola"));
Thus, this creates a subscription in the strip in order. Now I want to save this new subscription identifier in my database. I can get a list of data using this line:
echo "$cu->subscriptions";
The subscription ID is displayed there along with a host of other data, but I cannot isolate it and save it in a row.
Answer from the echo:
{
"object": "list",
"count": 1,
"url": "/v1/customers/cus_3bgSLHOiTUHFjq/subscriptions",
"data": [
{
"id": "sub_3c3YirUU5jAftr",
"plan": {
"id": "cocacola",
"interval": "month",
"name": "cocacola",
"created": 1392273785,
"amount": 80000,
"currency": "usd",
"object": "plan",
"livemode": false,
"interval_count": 1,
"trial_period_days": null,
"metadata": []
},
"object": "subscription",
"start": 1394065982,
"status": "active",
"customer": "cus_3bgSLHOiTUHFjq",
"cancel_at_period_end": false,
"current_period_start": 1394065982,
"current_period_end": 1396744382,
"ended_at": null,
"trial_start": null,
"trial_end": null,
"canceled_at": null,
"quantity": 1,
"application_fee_percent": null,
"discount": null
}
]
}
I am trying to save "sub_3c3YirUU5jAftr" to a string.