Closed hideokamoto closed 8 months ago
I think this is something that needs to be raised with Stripe, as to whether it's a bug on their platform, as using square brackets in their UI also results in a.. less than expected, unexpected request error.
https://github.com/WordPress/wordcamp.org/assets/767313/a4175f16-9aef-47d2-bb93-9b46acbbad88
I've raised a support ticket with them, as []
are not documented as being invalid in the field.
Describe the bug
When using Stripe payment for ticket purchases in Camptix, if the ticket name contains
[
, an error occurs in the Stripe API response. This is because the Stripe API specification interprets the string inside[]
as an object key. To resolve this issue, theclean_metadata
function needs to replace[]
with another character like()
.To reproduce
[
string, e.g.,6/2 – Micro Sponsor [ 10USD ]
Expected behavior
The ticket name needs to be included in the metadata of the Stripe Payment Intent object when creating Stripe Checkout Sessions API. e.g.:
$args['payment_intent_data']['metadata']['6/2 [Sponsor ticket]'] = '1';
**Expected Behavior The ticket name needs to be included in the metadata of the Stripe Payment Intent object when creating Stripe Checkout Sessions API. e.g.:
$args['payment_intent_data']['metadata']['6/2 [Sponsor ticket]'] = '1';
Actual Behavior**
Due to the Stripe API specification, a text inside the
[]
will be converted to an object key like the following:Suggestion In the
clean_metadata
function, we may need to replace the[]
string with another character like()
instead.When we avoid passing the
[]
string as the key of the metadata, the Stripe API request will work correctly.This idea seems reasonable, and if you approve, I'll proceed with creating a new pull request for this.
Screenshots
If applicable, add screenshots to help explain your problem.
WordCamp
If this is a problem on a specific WordCamp's site, list the site or page URL here.
At the WordCamp Kansai 2024, we suffered from this error: https://kansai.wordcamp.org/2024/wp-admin/post.php?post=3772&action=edit
System (please complete the following information):
Security Issues
To report a security issue, please visit the WordPress HackerOne program: https://hackerone.com/wordpress.