Stripe
Last updated
Last updated
To permit users to make payments to Stripe, add your Stripe account information to your Integrations by clicking Add a credential.... Provide a Publishable Key (and optional Secret Key), found from your Stripe account in the configuration.
Here is some Stripe documentation to help you find the required keys: https://docs.stripe.com/keys#obtain-api-keys
The Publishable Key must conform to the following format, depending on Formsort environment:
Production Key: Your live publishable key. It must start with pk_live_
.
Staging Key: Your test publishable key. It must start with pk_test_
.
To enable Stripe payments within your flow, from the Formsort Studio, create a Payment question, and set provider to Stripe. The Studio will then display which environments have Stripe credentials:
The default Stripe configuration is to disable Allow charging the card immediately. With this, a token will be sent as an answer to your data store, and you must handle charging the user through Stripe with the token ID.
Token ID in your answers payloads will appear as tok_XXXXXXXX
.
If you opt to enable "Allow charging the card immediately" , the stripe token collected from the user will be charged for either a fixed amount (in cents) you specify, or a variable amount, and a charge ID will be sent to your data stores.
The charge ID in your answers payloads will appear as ch_XXXXXXXXX
.
You will see a matching charge ID in the Payments section of your Stripe account.
The "variable amount" setting will allow you to dynamically update the charge amount based on the output of questions that have come previously. Variables that can be used as dependencies must have a return of a number
data type.
If you don't have a variable that returns a number
specifically, follow this process instead:
Write a calculated variable function that will return the variable amounts as a number
. This function should use another variable as input.
In the Stripe question, make the "variable amount" setting dependent on the calculated variable.
The Stripe integration will not be functional in the Live Preview window. Instead, an input area and a "start" button will be mocked up to get a sense of the styling of integration.
To experience a live test of the integration, deploy your form to the staging or production environments and test the functionality there.
Here is more Stripe documentation to help you set up your Stripe account for testing:
https://docs.stripe.com/testing#cards.
Always make sure to test before going live!