Be part of JetBrains PHPverse 2026 on June 9 – a free online event bringing PHP devs worldwide together.

socieboy's avatar

Retrive the Charge of a Subscription plan.

How can I retrive the $charge of

$user->subcription('monthly')->create($token);

this code return null..

I would like after subscribe a user get the data of the Charge that the Stripe API return.

0 likes
1 reply
sitesense's avatar
Level 19

I see from the docs that you should receive a json object (below).

https://stripe.com/docs/api/php#create_subscription

Stripe\StripeObject JSON: {
  "id": "sub_6Hu776VFQRE3XY",
  "plan": {
    "interval": "month",
    "name": "New plan name",
    "created": 1386247539,
    "amount": 2000,
    "currency": "usd",
    "id": "gold21323",
    "object": "plan",
    "livemode": false,
    "interval_count": 1,
    "trial_period_days": null,
    "metadata": {
    },
    "statement_descriptor": null
  },
  "object": "subscription",
  "start": 1432317118,
  "status": "active",
  "customer": "cus_6Hu67Xt6RLp1LQ",
  "cancel_at_period_end": false,
  "current_period_start": 1432317118,
  "current_period_end": 1434995518,
  "ended_at": null,
  "trial_start": null,
  "trial_end": null,
  "canceled_at": null,
  "quantity": 1,
  "application_fee_percent": null,
  "discount": null,
  "tax_percent": null,
  "metadata": {
  }
}

Please or to participate in this conversation.