#renlaer057
1 messages · Page 1 of 1 (latest)
Sorry I don't follow the question. What order do you mean?
I first created a checkout session and we developers got cs_test_a1XYgFhPB7Dj0lJYTQ45QR9fp8zgLblOM8zpBM0fRgdx7GaJhizRfyfad5. When the customer tried to pay, Stripe refused and the order was cancelled. Then we received the payment_intent.canceled event, but in this event, we did not see the ID cs_test_a1XYgFhPB7Dj0lJYTQ45QR9fp8zgLblOM8zpBM0fRgdx7GaJhizRfyfad5, which made us unable to update the order status
Developers need these two IDs to appear in the same event so that we can synchronously update the status of this order to canceled, otherwise it cannot correspond.
How can we solve it?
I see. When you create the Checkout Session, let's include a metadata for its underlying PaymentIntent. Later on when you received payment_intent.canceled, you can use the metadata there to match it back to your database
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
When we create the checkout session, we get this parameter "payment_intent": "pi_1Gt00z2eZvKYlo2CqQSXWcPB", ?
yes, expand it
Complete reference documentation for the Stripe API. Includes code snippets and examples for our Python, Java, PHP, Node.js, Go, Ruby, and .NET libraries.
I checked the checkout session I just created in the developer log, and it didn't return this parameter to me.
payment_intent
Request ID: req_i0FvtUmnQsr7XE
Payment_intent is not included in the response body
Is it necessary to listen to other webhook events to get Payment_intent?
Why is it a null value?
req_i0FvtUmnQsr7XE is when you created the Checkout Session. It hasn't been paid yet, so there will be no PaymentIntent.
Can you try the metadata parameter here? Then on payment_intent.cancelled, see if you see the metadata you set
What's the meaning?
When I create a checkout session, just fill in a value in the metadata?
Fill in a unique value arbitrarily?
Yes, and save it in your Database, like cs_test_xxx, map with metadata_y
Later on if you receive payment_intent.cancelled with metadata_y, you can matching back to your Database
to know that's cs_test_xxx
In payment_intent.canceled, this parameter was returned to me, which is "metadata": { },
right?
yeah (please test it out)
Look like so!
"metadata": {
},
},
"type": "charge.failed"
}
I'm in this event, I don't see the metadata I want, he is empty
This is a Charge object, right?
not a PaymentIntent
metadata is per object. Charge is an object inside the PaymentIntent object
No this is metadata on the Checkout Session object
。。。?
you want to set inside payment_intent_data.metadata instead
You can, but by a different paramter
not the direct metadata parameter, but payment)intent_data.metadata
Please give me a complete example about payment)intent_data.metadata
Depends on the language. For example in Ruby
co = Stripe::Checkout::Session.create({
success_url: 'https://example.com/success',
cancel_url: 'https://example.com/cancel',
line_items: [
{price: 'price_1JkLX8Emaib10qkRG67HAWt8', quantity: 2},
],
payment_intent_data: {
metadata: {
key: 'value',
}
},
mode: 'payment',
})
It's really just wrap inside a payment_intent_data block
Can you give me a copy of c#?
C# SDK var options = new SessionCreateOptions
{
LineItems = new List<SessionLineItemOptions>
{
new SessionLineItemOptions
{
PriceData = new SessionLineItemPriceDataOptions
{
UnitAmount = dto.AmountOfMoney,
Currency = dto.MonetaryUnit,
ProductData = new SessionLineItemPriceDataProductDataOptions
{
Name = dto.ProductName,
Description=dto.ProductDesc
},
},
Quantity = 1,
},
},
Mode = "payment",
SuccessUrl = domain,
CancelUrl = domain,
ConsentCollection = new SessionConsentCollectionOptions()
{
TermsOfService = "required",/**/
},
BillingAddressCollection = "required", // 收集账单地址
ShippingAddressCollection = new SessionShippingAddressCollectionOptions
{
},
PaymentMethodTypes = new List<string> { dto.PaymentMethodStr },
Metadata= new Dictionary<string, string>() { { "UnId", unId } }
//ExpiresAt = DateTime.Now.AddMinutes(dto.ExpireMinute)
};
These are the parameters the developer just filled in. Please help him correct them.
You should ask them join this chat
Stripe.net is a sync/async .NET 4.6.1+ client, and a portable class library for stripe.com. - stripe/stripe-dotnet
Stripe.net is a sync/async .NET 4.6.1+ client, and a portable class library for stripe.com. - stripe/stripe-dotnet
He has no discord
What do these addresses mean? Send him to check?
You sent 2, which one should he look at?
According to my code, can you modify the correct parameters for me?
C# SDK var options = new SessionCreateOptions
{
LineItems = new List<SessionLineItemOptions>
{
new SessionLineItemOptions
{
PriceData = new SessionLineItemPriceDataOptions
{
UnitAmount = dto.AmountOfMoney,
Currency = dto.MonetaryUnit,
ProductData = new SessionLineItemPriceDataProductDataOptions
{
Name = dto.ProductName,
Description=dto.ProductDesc
},
},
Quantity = 1,
},
},
Mode = "payment",
SuccessUrl = domain,
CancelUrl = domain,
ConsentCollection = new SessionConsentCollectionOptions()
{
TermsOfService = "required",/**/
},
BillingAddressCollection = "required", // 收集账单地址
ShippingAddressCollection = new SessionShippingAddressCollectionOptions
{
},
PaymentMethodTypes = new List<string> { dto.PaymentMethodStr },
Metadata= new Dictionary<string, string>() { { "UnId", unId } }
//ExpiresAt = DateTime.Now.AddMinutes(dto.ExpireMinute)
};
No, please ask your developer to. Send him those 2 links and they would know