Jump to content

Get metadata from Stripe Session


doc1355
Go to solution Solved by doc1355,

Recommended Posts

I have a stripe session that when I print I get the following: 

Stripe\LineItem Object
(
    [id] => li_1JwCsEAy5kUVbSuGjlYtZ6l7
    [object] => item
    [amount_subtotal] => 2599
    [amount_total] => 2340
    [currency] => usd
    [description] => 2022 - Season 1
    [price] => Stripe\Price Object
        (
            [id] => price_1JwCsEAy5kUVbSuGHcfoxDhg
            [object] => price
            [active] => 
            [billing_scheme] => per_unit
            [created] => 1637012278
            [currency] => usd
            [livemode] => 
            [lookup_key] => 
            [metadata] => Stripe\StripeObject Object
                (
                )

            [nickname] => 
            [product] => prod_KbPhMZ545KIQ90
            [recurring] => 
            [tax_behavior] => unspecified
            [tiers_mode] => 
            [transform_quantity] => 
            [type] => one_time
            [unit_amount] => 2599
            [unit_amount_decimal] => 2599
        )

    [quantity] => 1
)


Stripe\LineItem Object
(
    [id] => li_1JwCsEAy5kUVbSuGDqbrfvRm
    [object] => item
    [amount_subtotal] => 2899
    [amount_total] => 2608
    [currency] => usd
    [description] => 2022 - Season 2
    [price] => Stripe\Price Object
        (
            [id] => price_1JwCsEAy5kUVbSuGW58akYjw
            [object] => price
            [active] => 
            [billing_scheme] => per_unit
            [created] => 1637012278
            [currency] => usd
            [livemode] => 
            [lookup_key] => 
            [metadata] => Stripe\StripeObject Object
                (
                )

            [nickname] => 
            [product] => prod_KbPhcd6yq2Mrl6
            [recurring] => 
            [tax_behavior] => unspecified
            [tiers_mode] => 
            [transform_quantity] => 
            [type] => one_time
            [unit_amount] => 2899
            [unit_amount_decimal] => 2899
        )

    [quantity] => 1
)

I don't know how to get the values from this data, like value of amount_total and ... 

Also, and more importantly, I need to get the values from [metadata]. There are two metadata information for each price, which I like to get. 

 

Thank you,

Link to comment
Share on other sites

When I look in Stripe dashboard, I see the metadata is saved appropriately under the price. But I don't know why it is not showing here, instead it is returning Stripe\StripeObject Object

that's what I'm trying to figure out so that I can use that data. 

 

Link to comment
Share on other sites

  • Solution

Thank you for your reply. But I was able to figure this out. 

The metadata is associated with another object. I used the ID from this object to retrieve the second object and was able to retrieve the metadata there. 

Thank you again for your help. 

Link to comment
Share on other sites

This thread is more than a year old. Please don't revive it unless you have something important to add.

Join the conversation

You can post now and register later. If you have an account, sign in now to post with your account.

Guest
Reply to this topic...

×   Pasted as rich text.   Restore formatting

  Only 75 emoji are allowed.

×   Your link has been automatically embedded.   Display as a link instead

×   Your previous content has been restored.   Clear editor

×   You cannot paste images directly. Upload or insert images from URL.

×
×
  • Create New...

Important Information

We have placed cookies on your device to help make this website better. You can adjust your cookie settings, otherwise we'll assume you're okay to continue.