#Omri - checkout Pi metadata
1 messages · Page 1 of 1 (latest)
what is the syntax?
I getting the error: Stripe::InvalidRequestError - Received unknown parameter: payment_intent_data[0]:
could you share your code snippet please?
donation_ids: donation_ids.map(&:inspect).join(', ')
}
Stripe::Checkout::Session.create({
payment_method_types: [type],
line_items: [{
price: price.id,
quantity: 1,
}],
payment_intent_data: {
metadata: metadata,
},
mode: 'subscription',
success_url: "http://localhost:3003/stripe/redirect_sepa_debit?back_url=#{back_url}&occurrences=#{params[:occurrences]}&session_id={CHECKOUT_SESSION_ID}",
cancel_url: back_url,
}, {stripe_account: @entity.stripe_uid})```
this would fix the issue
metadata: metadata,
},
basically payment_intent_data is hash and not an array
yes, I tried it also
I'll send you the error
```Stripe::InvalidRequestError - You can not pass payment_intent_data in subscription mode.:
do you have a request id req_xxx ? here's how you can find it https://support.stripe.com/questions/finding-the-id-for-an-api-request
Find help and support for Stripe. Our support center provides answers on all types of situations, including account information, charges and refunds, and subscriptions information. Get your questions answered and find international support for Stripe.
oh sorry didn't notice you were in mode: 'subscription'
yes basically payment_intent_data is only available for mode payment
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
A subset of parameters to be passed to PaymentIntent creation for Checkout Sessions in payment mode.
you can add metadata to the subscription in that case using this https://stripe.com/docs/api/checkout/sessions/create#create_checkout_session-subscription_data
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
could you please tell me your use case so I could help you find a suited solution?
yes, but I need the data in the webhook of payment_intent.succeeded event
when you're doing subscriptions you should listen to invoice.paid instead of payment_intent.succeeded
ok, and how I will get the metadata form the invoice object?
you can expand on the subscription object on the invoice https://stripe.com/docs/api/invoices/object#invoice_object-subscription
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
and then you will find the metadata on the subscription object https://stripe.com/docs/api/subscriptions/object#subscription_object-metadata
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
but I'm create subscription schedule not subscription
could you please provide an example with a request id so I could take a better look?
what is the price id that you are using? price_xxx
ok when you say you are using subscription schedule you're doing that when you are creating a recurring price as the one you sent above?
no, I doing that after the user complete the SEPA direct debit form
but you are already creating a subscription when you create the checkout session
I create the checkout session with subscription mode it is mean that I'm create subscription ?
yes
ok so how I add the metadata to the invoice object?
once the user completes the checkout session the invoice will be paid and you will get an invoice.paid event on your webhook endpoint, which then you could use to get the subscription and get the metadata on the subscription
ok, thank you
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
right?
yes exactly