• Resolved Vanois.be

    (@lepapefrancois)


    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 fields

    Filling 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

    1. 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 the isset( $payment_intent['status'] ) and 'succeeded' === $payment_intent['status'] then it push the wpcf7_submission_timestamp to 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.

    • This topic was modified 5 months ago by Vanois.be. Reason: format text
Viewing 4 replies - 1 through 4 (of 4 total)
  • Plugin Author Takayuki Miyoshi

    (@takayukister)

    Where can we see the website in question?

    Thread Starter Vanois.be

    (@lepapefrancois)

    Hi Takayuki,

    Thanks for your help!

    The test form is here: https://afiscep.be/0000-00-test-form-payment/

    • Complete the name and email field
    • Select one option in the dropdown to fill the “amount_to_pay” field in.
    • Submit

    WordPress version: 6.9.4 (latest)
    CF7 version 6.1.6 (latest)
    Akismet version 5.7 (latest)
    Contact Form Entries version 1.5.0 (latest) -> when I disable this extension it doesn’t change anything to the current problem.

    If you need something else, feel free to ask.

    Best Regards,

    Plugin Author Takayuki Miyoshi

    (@takayukister)

    What other plugins and theme do you use on the site?

    Thread Starter Vanois.be

    (@lepapefrancois)

    Alright, I found that when I disable the plugin Send PDF for Contact Form 7 the Stripe integration works as intended.

    That’s a concern for me as I need a plugin to generate and send PDF files on others forms on the website. And really, Send PDF for Contact Form 7 works very well for that.

    I will contact the plugin Developper and see what it can do. Ultimately, I will try to disable the plugin using something like this:

    add_action(
    'wpcf7_before_send_mail',
    function ( $contact_form, &$abort, $submission ) {
    $amount = $submission->get_posted_data( 'amount_to_pay' );

    if ( !empty($amount)) {
    remove_action( 'wpcf7_before_send_mail', '???-plugin-typical-action-???', 10 );
    }
    },
    9,
    3
    );

    Thanks

Viewing 4 replies - 1 through 4 (of 4 total)

You must be logged in to reply to this topic.