Invalid Stripe Payment Intent ID detected.
-
Hi,
In brief : I’m using the Stripe integration for the first time and every e-mail are marked as spam even when the payment is a success.
In details:
The CF7 form
[text* name class:with-icon placeholder "Name"]
[email* email class:with-icon placeholder "E-mail"]
[text amount_to_pay] // the field value (integrer) is populated based on several choices (not shown here) made by the user
[turnstile theme:light] // Cloudflare Turnstile is configured since several month and works perfectly.
[stripe "Submit" "Pay with Stripe"]In function.php
add_filter(
'wpcf7_stripe_payment_intent_parameters',
function ( $params ) {
// Get the WPCF7_Submission object
$submission = WPCF7_Submission::get_instance();
// Set currency
$params['currency'] = 'eur';
// Set the amount
$params['amount'] = $submission->get_posted_data( 'amount_to_pay' );
// Set the receipt email (receipt send by e-mail by Stripe)
$receipt_email = $submission->get_posted_data( 'email' );
if ( is_email( $receipt_email ) ) {
$params['receipt_email'] = $receipt_email;
}
return $params;
},
10, 1
);Stripe integration
Have set a test environment in the Stripe Dashboard.
Public and private test keys are paste in CF7 > Stripe integration fieldsFilling the form in
- I enter my name and e-mail adress, I choose some options (not display in the form here above), the amount to pay is calculated and populated in the [amount_to_pay].
- I click on Submit, the stripe field is shown
- I enter one of the test card number provided by Stripe, enter a future date for MM/YY expiration and a random CVC number (as suggested by Stripe)
- I click on Pay with Stripe button.
Results
- The frontend response is the error spam message, no e-mails are sent.
- The form is submitted, it appears in Flamingo in the spam tab.
- In the Stripe Dashboard, the payment is marked as a success.
- The spam log in Flamingo is “Invalid Stripe Payment Intent ID detected.”
Stripe API request details
- POST to /v1/payment_intents (status 200)
{
"amount": "1000",
"currency": "eur",
"receipt_email": "test@vanois.be"
}2. POST to /v1/payment_intents/pi_3TWXLTK5isH0xlR00Q2Abhsl/confirm (status 200)
{
"client_attribution_metadata": {
"client_session_id": "0d*****-****-****-****-*********4a",
"merchant_integration_source": "elements",
"merchant_integration_subtype": "card-element",
"merchant_integration_version": "2017",
"wallet_config_id": "81******-****-****-****-**********c2"
},
"client_secret": "************************************************************",
"expected_payment_method_type": "card",
"key": "pk_test_*********************************************************************************************ymgpPE",
"payment_method_data": {
"card": {
"cvc": "***",
"exp_month": "11",
"exp_year": "28",
"number": "************0004"
},
"client_attribution_metadata": {
"client_session_id": "0d*****-****-****-****-*********4a",
"merchant_integration_source": "elements",
"merchant_integration_subtype": "card-element",
"merchant_integration_version": "2017",
"wallet_config_id": "81******-****-****-****-**********c2"
},
"guid": "NA",
"muid": "NA",
"payment_user_agent": "stripe.js/f960f402f5; stripe-js-v3/f960f402f5; card-element",
"referrer": "https://vanois.be",
"sid": "NA",
"time_on_page": "53587",
"type": "card"
},
"radar_options": {
"hcaptcha_token": "20000000-aaaa-bbbb-cccc-000000000002"
},
"use_stripe_sdk": "true"
}3. POST to /v1/payment_intents/pi_3TWXLTK5isH0xlR00Q2Abhsl (status 200)
{
"metadata": {
"wpcf7_submission_timestamp": "1778657837"
}
}What’s wrong ?
I understand that the CF7 function
wpcf7_stripe_skip_spam_check()check theisset( $payment_intent['status'] ) and 'succeeded' === $payment_intent['status']then it push thewpcf7_submission_timestampto the$payment_intent['metadata']which is done in the 3rd API POST (see above).How is the “Invalid Stripe Payment Intent ID detected.” error possible as I can see that CF7 found and used the $pi_id all along.
What can I do to make it works?
Thanks for your precious help.
You must be logged in to reply to this topic.