Get Stripe payment amount from webform field value

Created on 5 April 2025, 13 days ago

Problem/Motivation

Set custom amount from webform field value

Steps to reproduce

I want to set the custom payment amount in the Stripe Payment Options to the value of a webform field.

Is there a way to do this?

Proposed resolution

Remaining tasks

User interface changes

API changes

Data model changes

πŸ’¬ Support request
Status

Active

Version

1.0

Component

Documentation

Created by

πŸ‡ΊπŸ‡ΈUnited States akramer603

Live updates comments and jobs are added and updated live.
Sign in to follow issues

Comments & Activities

  • Issue created by @akramer603
  • πŸ‡ΈπŸ‡ΎSyria hodba Dubai

    You can set the amount as a token from the field that you need to set the value from. For this to work, you need to put the stripe payment field in a separate page. Otherwise, you need to using the webform hook_alter to trigger an ajax callback to update the amount value on the Stripe element.

  • πŸ‡ΊπŸ‡ΈUnited States akramer603

    I put the stripe payment option on a separate page.
    I tried putting a token in the Amount field in the stripe payment options. I used [webform:element:donation_amount:title], this may not be correct but it is the field I want. Upon saving I got the error "The price amount or currency is not defined, please correct this and try again." When I test the form I get "Oops, something went wrong. Check your browser's developer console for more details." The developer console says there was an ajax error.

    Is there documentation or examples for setting this up? Thanks

  • πŸ‡ΊπŸ‡ΈUnited States akramer603

    I got it to pass the webform field for the transaction amount by using the correct token :)

    This works: [webform_submission:values:donation_amount] (it does still product the error when saving the field but it does work)

    I feel like there should be a way to get the contact fields for the billing information from form fields that are already filled out.

Production build 0.71.5 2024