Skip to main content
images/stripe.svg

Authorization Hold Endpoint (Morf Forms)

Integrate a form with Morf’s Stripe endpoint to generate a customer, card, and authorization hold from a Stripe token. Find out in real time if a credit card is eligible to charge.
  1. A token is generated by the form builder for one-time use.
  2. Morf passes the token to Stripe and:
    • Creates and associates a Stripe customer if one isn’t already associated with the Morf profile.
    • Creates a card using the token.
    • Charges and immediately refunds $1 to the card.
  3. The endpoint returns Stripe details, letting users know immediately that their card went through.

Inputs

  • morfOrgId
  • patientId
  • stripeToken (generated in form)

Outputs

  • stripeCustomerId
  • stripePaymentSourceId
  • stripePaymentIntentId
  • stripePaymentIntentStatus
  • message (only returned in the case of an error)

Morf Form Setup

Coming soon! Reach out to Morf support if you’re interested in implementing a Stripe auth hold in your Morf form.

Formsort Setup

Integrate your form with Stripe

From your form, navigate to Integrations > Stripe. Add credentials for your Stripe test and live keys to their corresponding Formsort environment.

Integrate Morf with Stripe

  1. In your Morf dashboard, navigate to Integrations and click + New Integration.
  2. Select Stripe and enter your Stripe access token.
  3. Stripe staging and production environments must each be set up in their respective Morf organizations.

Add a step for credit card entry

  1. Navigate to your variant and add a step for credit card collection.
  2. Add a payment to the step and name it stripe_token_id. Select Stripe as the provider.
  3. Leave all other payment settings off.

Create Formsort variables

  • morf_org_id (calculated variable) — This variable likely already exists in your form. If not, create a new calculated variable with type string and set Blocks advancing from current step to true. Enable Use other variables and add formsort_environment. Add the following to the Getter Function Body:
  • stripe_charge_card (API variable) — A POST request to https://questions.morf.health/api/createCustomerAndStoreCard. Configure the variable settings and API parameters per your form’s field mapping.

Handle credit card errors

  1. After the credit card collection step, add a new step for credit card errors. Users will be directed to this step if the Stripe API call fails to create the customer, card, or authorization hold.
  2. Under step logic, set Show conditionally to true and configure the condition based on the stripe_charge_card response.

(Optional) Allow credit card retry

If a card fails, allow users to try a different card.Add logic and steps
  • Update your credit card error step to serve as a retry step. Add messaging informing the user they can try again with a different card.
  • Add a payment field to the step named stripe_token_retry and select Stripe as the provider.
Create retry variables
  • stripe_charge_card_retry (API variable) — A POST request to https://questions.morf.health/api/createCustomerAndStoreCard. Configure variable settings and API parameters using stripe_token_retry.
  • stripe_info (calculated variable) — Contains the most recent result of the Stripe API call. Add the following to the Getter Function Body:
Handle retry errorsAfter the credit card retry step, add a new step for retry errors. Users will be directed here if the Stripe API call fails on the retry attempt. Set Show conditionally to true and configure the condition based on the stripe_charge_card_retry response.

Workflow Action Reference

The sections below document the Create Card workflow action.

Parameters

Parameters

Result Object Field Details

You can use the result of the action’s data as inputs to downstream workflow actions. Each fetch action requires an object name, which nests the action’s result data inside the downstream data context in the workflow. See Passing Data Between Actions for how to set it and reference the result from downstream nodes. Here we demonstrate how to refer to this data using the prefix $result_object_key.
Fetch Action Response Object