Stripe Payment

Embed a Stripe Payment Element directly inside an ACF front-end form. The field handles client-side payment collection and records the PaymentIntent result to the post meta when the form is submitted.

Pro field

Stripe Payment requires the Extra Fields for ACF Pro license.

!
Front-end forms only

This field is designed for ACF front-end forms rendered with acf_form(). It is hidden in the WordPress admin and does not collect real payments from the back end.

Settings

SettingDefaultDescription
Modetesttest · live — switch to live only when ready for real transactions.
Publishable Key(empty)Your Stripe publishable key (pk_test_... or pk_live_...).
Secret Key(empty)Your Stripe secret key (sk_test_... or sk_live_...). Stored encrypted.
Webhook Secret(empty)The whsec_... value from your Stripe webhook endpoint settings.
Amount0Payment amount in the currency’s smallest unit (e.g. cents for USD). 0 = dynamic.
CurrencyusdISO 4217 lowercase currency code.
Statement Descriptor(empty)Text shown on the cardholder’s bank statement (max 22 characters).

Return values

After a successful payment the field stores and returns a JSON-encoded object. get_field() returns a PHP array.

$payment = get_field('booking_payment');
// [
//   'status'             => 'succeeded',
//   'payment_intent_id'  => 'pi_3PqXyz...',
//   'amount'             => 4900,
//   'currency'           => 'usd',
// ]

Returns false or an empty value if no payment has been completed.

Usage

Checking payment status before granting access

$payment = get_field('event_payment', $post_id);

if (is_array($payment) && ($payment['status'] ?? '') === 'succeeded') {
    // Grant access — e.g. send ticket confirmation email
    echo '<div class="access-granted">Your booking is confirmed.</div>';
} else {
    echo '<div class="access-denied">Payment required to access this event.</div>';
}

Displaying the PaymentIntent ID for records

$payment = get_field('order_payment');

if ($payment && $payment['status'] === 'succeeded') {
    printf(
        '<p>Payment ID: <code>%s</code> — Amount: %s</p>',
        esc_html($payment['payment_intent_id']),
        esc_html(number_format($payment['amount'] / 100, 2) . ' ' . strtoupper($payment['currency']))
    );
    // "Payment ID: pi_3Pq... — Amount: 49.00 USD"
}

Rendering the front-end form

acf_form([
    'post_id'     => 'new_post',
    'post_title'  => false,
    'submit_value' => 'Pay & Book',
    'html_before_fields' => '<h2>Complete your booking</h2>',
]);
Test mode first

Always configure and test with pk_test_ / sk_test_ keys before switching to live mode. Use Stripe's test card 4242 4242 4242 4242 to simulate payments.