#xfechx-coupon-gift-cards

1 messages ยท Page 1 of 1 (latest)

torn thicketBOT
north tartan
#

Hi there!

hasty hare
#

hello @north tartan

north tartan
#

What is your quesiton?

hasty hare
#

about the account header

#

on a charge.succeded from a connected account. It is behaving not like usual... or I am doing something wron

#

wrong

#

I am creating a payment link, through a connected account via the stripe_account parameter

#

stripe_user_id

#

but when I see the logs and the error, through my webhook, it is not recognizing the event

#

and I can see "application" instead of "account"

#

this is the event

#

can you please tell me why am i getting the error:

#

<h4>We are sorry</h4><p><strong>There was a problem with your transaction<br>No such notification: 'evt_3M3NbvLeN6kOhyrs0hPfTj8v'

#

can you tell me which account / API is trying to process the function? my code takes the connected account through the event json

#

$connected_account = array('stripe_account' => $event_json->account);

#

$event = \Stripe\Event::retrieve($event_id, $connected_account);

north tartan
#

<h4>We are sorry</h4><p><strong>There was a problem with your transaction<br>No such notification: 'evt_3M3NbvLeN6kOhyrs0hPfTj8v'
Can you clarify where you see this error?

hasty hare
#

in webhook

#

of the connected account

#

in the logs, I am echoing stripe error, everytime I call a stripe function, through try and catches

#

the weird thing is that the same code, works for many other places, not sure what is happening, that is why i need some help

#

is this because I need to set up the webhook in the main (platform) account,

#

instead of the connected account webhooks yes? I think this is the issue

north tartan
#

Foud this error in your webhook dashboard:

No such notification: 'evt_3M3NbvLeN6kOhyrs0hPfTj8v'; a similar object exists in test mode, but a live mode key was used to make this request.
So it looks like you are using your livemode key to fetch a testmode object

hasty hare
#

just a remider please

#

Where do I listen/process to webhooks from connected accounts, It is directly under the platform, yes ?

north tartan
hasty hare
#

Also - there is a limit of 16 webhooks.

#

this is very little

#

I am already out

#

what do I need to do in this case?

real spruce
#

Good question. Looking in to whether it is possible to use more webhooks. Otherwise you may need your servers to disseminate information amongst themselves more.

#

Also is there a reason you need these events to go to more than 16 URLs? It looks like you might be dividing up the events by URL?

hasty hare
#

No, sorry your assumption is wrong

#

I use a listener for domain

real spruce
#

Can you explain that more? That was just a guess, definitely interested in the real reason

hasty hare
#

sure. It is because it is an app that is been used in differfent domains

#

also - I have a problem with not seeing metadata on charge.succeded while I am passing it through a payment link checkout

#

I can see it on the checkout.session.completed, but I need it on the charge, as my app listens to charge.succeded

real spruce
#

How are you passing the metadata to your payment link?

hasty hare
#

through prices and products

#

or how am I supposed to make the metadata to payment link?

real spruce
#

I don't know if the metadata can make its way to the charge itself. For Checkout Sessions that you directly create, the metadata can be passed on to the payment intent, but you have to do that by specifically passing it as an argument elsewhere

#

I will check if this is possible with payment links

hasty hare
#

actually sorry

#

I pass the metadata through payment link API creation

#

how can I see the metadata of the payment link on the charge? Or where can I pull it from? I need my payment links to contain metadata

real spruce
#

The Payment Link itself will have metadata on it if you do that, but metadata isn't automatically copied between objects.

#

It looks like payment links can't set metadata for their payment intents or charges

#

Or you can listen to the checkout.session.completed webhook and when you get that webhook you can set metadata on the charge that succeeded

hasty hare
#

yes, i think I will need to search for the checkout session within the charge, how do I do that?

#

because otherwise I will have to create that event condition, and my app heavily uses charge.succedded for receipts, webhooks, processing metadata, etc.

real spruce
hasty hare
#

ok let me try it

hasty hare
#

is there another way which is not by listing ALL checkout sessions?

#

somewhere where I can associate the charge with the checkout session it corresponds to?

half sand
#

Hi there ๐Ÿ‘‹ please bear with me a moment while I catch up on the context here.

#

No, there is not a way to directly find the Checkout Session that is related to a given Charge without listing Checkout Sessions.

hasty hare
#

how do I get the checkout session related to that specific charge, by listing the checkout sessions?

half sand
hasty hare
#

but where does the argument go?

#

I don't see it in the documentation

half sand
hasty hare
#

thanks a lot for previous help, I sorted it out. I have another question regarding promotion codes vs coupons

#

What is the main difference? I notice that promo codes can be used in checkout. But coupons not?

half sand
#

Coupons are the objects that create the discounts, and Promotion Codes are a Customer-facing object that can be created for a Coupon so that you can provide your customers with a way to include that discount when working with a Stripe-hosted surface such as Checkout Sessions.

hasty hare
#

OK, I am creating a module in which a user in the app can create paid-coupon. Like a gift card. When payment succeeds, the webhook will then create the coupon + promo code.

Then I will need to compare against something to 'USE' the promo codes. But they aren't necessarily tied to a stripe purchase..

How can I mark them as used, via the API?

#

like input promo code, output: used or not used, if not used - mark as used

half sand
#

Hm, are these gift-card/credit flows specific to an individual Customer, or are they available for anyone to use?

#

xfechx-coupon-gift-cards

hasty hare
#

no, because it is not fully related to stripe charges and discounts

#

*not exclusively

#

they can also be used if a customer wanted to pay in cash for example. In that scenario, I need to find a way to 'use' the promotion codes, i.e to use them against the database of promotion codes, or something.

half sand
#

Ah, gotcha. We do have means to allow limit the number of redemptions for a Coupon and Promotion Code objects, but that may not work well if they're going to be "consumed" by processes outside of Stripe.

#

You'll likely need to design your own mechanism for tracking whether these objects have been used by various pieces of your flow. You may want to consider setting the active field on Promotion Codes to false once they're consumed, or delete the Coupon objects.

Alternatively, you can leverage metadata to add your own custom tracking fields to these objects:
https://stripe.com/docs/api/metadata

hasty hare
#

thanks for the answer, let me go through it

#

ok, i think the active field will do the trick

#

how do I modify this field?

charred oyster
#

Hi ๐Ÿ‘‹
I"m stepping in as Toby had to go

hasty hare
#

Hi @charred oyster thanks

#

also - I have another question, can I add custom fields to payment links ?

charred oyster