#CameronBryce
1 messages ยท Page 1 of 1 (latest)
Hello ๐
So, I'm using the Stripe API to filter through each subscription, if the customer has paid already, it will collect the metadata:
guildIdentification
1073466319254601839
userIdentification
812809631767986226
I was wondering how I could manually input this information?
I created a fake account, at the very top image, to test.
When clicking their account, it says I need to create a subscription:
You can open the Customer directly in Dashboard and find the Metadata section, then click "Edit"
const subscriptions = await stripe.subscriptions.list({ status: 'active' });
const activeSubscriptions = subscriptions.data;
activeSubscriptions.forEach(subscription => {
if (subscription.metadata.guildIdentification === interaction.guild.id) {
// Code here ...
}
});
Would this still be able to access that metadata?
So this is Subscription metadata, not Customer metadata, right?
So, I figured I can make a customer account for them, then create a subscription. Though, unsure how I can label it as free.
I am a bit confused. If you are looking for editing metadata on a Subscription, then go directly to its page and click on Edit of the metadata section
I apologize, I'm not the best with Stripe yet.
Do you mean going to the products, then selecting the product, then editing the metadata through there? Or is there another way to do that?
Wait, I think I might just be leaving information out.
PAYMENT COLLECTION METHOD
async execute(interaction) {
await interaction.deferReply({ ephemeral: true });
const session = await stripe.checkout.sessions.create({
success_url: '...',
line_items: [{ price: '...', quantity: 1 }],
subscription_data: {
'metadata': { userIdentification: interaction.member.id, guildIdentification: interaction.guild.id },
},
allow_promotion_codes: true,
mode: 'subscription',
});
PAYMENT FILTER METHOD
const subscriptions = await stripe.subscriptions.list({ status: 'active' });
const activeSubscriptions = subscriptions.data;
activeSubscriptions.forEach(subscription => {
if (subscription.metadata.guildIdentification === interaction.guild.id) {
// Code here ...
}
});
So, when going to view the product, there is no metadata.
Though, when I click on a customer, it shows if they're paying for it:
By clicking the active subscription, that's where it's storing the metadata:
Yep. each object can have its own metadata. Think it like a tagging system. Here when you created the Checkout Session, you specified
subscription_data: {
'metadata': { userIdentification: interaction.member.id, guildIdentification: interaction.guild.id },
},
That means the Subscription will have metadata
Got it, how might I be able to edit the subscriptions metadata manually on the dashbaord?
On the Subscription page in Dashboard you are seeing the Metadata section, right? right hand side it has "Edit Metadata"
That's the Customer page! You have a screen above of the Subscription
this one
Got it, I normally have to select a customer to get that data, when selecting the manual made one, it doesn't show that info, it shows this
Yep Customer and Subscription are 2 different objects
So, how might I create a subscription for a customer without the API?
You can create via Dashboard https://dashboard.stripe.com/test/subscriptions. There is a button on upper right hand side "Create Subscription"
Sign in to the Stripe Dashboard to manage business payments and operations in your account. Manage payments and refunds, respond to disputes and more.
When doing this, would I need to input a card? I'm looking to give them free access, for as long as the subscription exists.
If I do this, applying this coupon, would it be safe to use my own card?
If it's 100% off, forever
Technically yes but I would recommend test on Test mode first
Okay, got it. Would there be any other way?
For not using Test mode?
Just to give a customer a subscription, for free
You can setup a trial period until when you want to offer for free, or you can give the Customer some credit note before hand, or add some negative Invoice Item into their first Invoice. There are various ways to achieve that, just play with it in Test mode ๐