#xfechx-coupon-gift-cards
1 messages ยท Page 1 of 1 (latest)
Hi there!
hello @north tartan
What is your quesiton?
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);
<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?
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
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
just a remider please
Where do I listen/process to webhooks from connected accounts, It is directly under the platform, yes ?
Correct. You can learn more about this here: https://stripe.com/docs/connect/webhooks
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?
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?
Can you explain that more? That was just a guess, definitely interested in the real reason
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
How are you passing the metadata to your payment link?
through prices and products
or how am I supposed to make the metadata to payment link?
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
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
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
So it looks like the easiest way to do this would be to find the Checkout Session for your charge, then you can look up the payment link it was made from and use the metadata that you set there https://stripe.com/docs/api/checkout/sessions/object#checkout_session_object-payment_link
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
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.
You would use the payment_intent field on the Charge as an argument to the List Checkout Sessions call. That would return the session associated with your charge https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-payment_intent
ok let me try it
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?
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.
how do I get the checkout session related to that specific charge, by listing the checkout sessions?
Yup, you would use the approach that my teammate provided you in this message:
From the Charge object, you pull the ID of the associated Payment Intent, from this field:
https://stripe.com/docs/api/charges/object#charge_object-payment_intent
You then pass the value from that field into the payment_intent field when listing the Checkout Sessions. This is the same link that was provided earlier, but it points to the exact parameter to be used:
https://stripe.com/docs/api/checkout/sessions/list#list_checkout_sessions-payment_intent
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?
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.
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
Hm, are these gift-card/credit flows specific to an individual Customer, or are they available for anyone to use?
xfechx-coupon-gift-cards
I'm asking because if these are a type of customer credit flow, then our concept of a customer credit balance may be a better fit here:
https://stripe.com/docs/billing/customer/balance
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.
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
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?
Hi ๐
I"m stepping in as Toby had to go
Hi @charred oyster thanks
also - I have another question, can I add custom fields to payment links ?
Okay so first you modify the active parameter on a Promo code via an Update API call: https://stripe.com/docs/api/promotion_codes/update