#ddr3ram
1 messages ยท Page 1 of 1 (latest)
Hello
code says there is no metadata and discord id isnt definded but i have enterd the discord id on the purchase page a few times 100% and its a required box
Hi! Let me help you with this.
Thanks
Could you please share the Subscription ID sub_xxx?
Where are you adding this field?
I see, the result is saved into one of the related objects. I haven't seen this used with Payment Links yet, so I need a moment to find where the custom fields live.
Okay thanks
Sorry, it's taking some time, it's actually not that straightforward.
Its fine just happy for any support.
I see where it's saved but I am looking for a way you can access it, it's a bit hidden. But it won't be saved in the metadata though.
Hm how come it doesnt go into metadata tho? its a custom field
metadata is meant to be updated via API/Dashboard, but this is entered by customers on the checkout, that's why it's kept separate. But I see what you mean.
Ah alright thanks for the support so far.
We will find it, don't worry!
Thanks ๐
๐ taking over for my colleague. Let me catch up.
Alright, is this a first time this has happend?
just trying to read through the thread, give me please a second
Alright take ur time
from the subscription ID you can list the Checkout Sessions by subscription https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-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.
Yeah but there is no custom fields there
and then you can check custom_fields[0].numeric.value
Processing subscription sub_1NL1QtE36rZQjhzLOttwbxds with status trialing
Discord ID: undefined
Error: Discord ID is undefined
Fetching subscriptions...
Subscriptions: {
object: 'list',
data: [
{
id: 'sub_1NL1QtE36rZQjhzLOttwbxds',
object: 'subscription',
application: null,
application_fee_percent: null,
automatic_tax: [Object],
billing_cycle_anchor: 1687341907,
billing_thresholds: null,
cancel_at: null,
cancel_at_period_end: false,
canceled_at: null,
cancellation_details: [Object],
collection_method: 'charge_automatically',
created: 1687255507,
currency: 'gbp',
current_period_end: 1687341907,
current_period_start: 1687255507,
customer: 'cus_O7FwoLBcZh23iR',
days_until_due: null,
default_payment_method: 'pm_1NL1QNE36rZQjhzLKgKZYEd8',
default_source: null,
default_tax_rates: [],
description: null,
discount: null,
ended_at: null,
items: [Object],
latest_invoice: 'in_1NL1QtE36rZQjhzLDKlhGW8V',
livemode: true,
metadata: {},
next_pending_invoice_item_invoice: null,
on_behalf_of: null,
pause_collection: null,
payment_settings: [Object],
pending_invoice_item_interval: null,
pending_setup_intent: null,
pending_update: null,
plan: [Object],
quantity: 1,
schedule: null,
start_date: 1687255507,
status: 'trialing',
test_clock: null,
transfer_data: null,
trial_end: 1687341907,
trial_settings: [Object],
trial_start: 1687255507
}
],
has_more: false,
url: '/v1/subscriptions'
}
Discord ID: undefined
Error: Discord ID is undefined
that's the subscription ID
you need to list Checkout Sessions and filter by subscription
as I described above
So i can get the custom field discord id ?
yes
the Custom Fields live on the Checkout Session that created the Subscription
and not the Subscription object itself
Alright let me try.
what you can do, is using webhooks, specifically the checkout.session.completed event, you can then take the custom_fields and update the subscription's metadata
you can do that all on the website correct?
this explains how to create a webhook endpoint for checkout https://stripe.com/docs/payments/checkout/fulfill-orders
alr thanks
let me know if you need any more help
Ok thanks