[GUIDE] How to Create Dynamic Stripe Payment Links

  • 20 February 2022
  • 5 replies
  • 648 views

Userlevel 7
Badge +14

💲 [guide] How to Create Dynamic Stripe Payment Links

 

Purpose

How to create dynamic Stripe Payment Links via a Zap with different Products and Prices.

 

Use Case

You want to create a custom Payment Link for a client based on their selections in a form.

 

Prep

You’ll need your Stripe API Key: https://stripe.com/docs/keys

Best practice is to use your TEST Stripe API Key first, then switch to your LIVE Stripe API Key.

NOTE: The examples below will focus on the minimum required fields, but know there are additional options available to configure each Zap step based on the Stripe API documentation for each endpoint.

 

Stripe Payment Links

Learn more: https://stripe.com/docs/payments/payment-links

 

Zap Steps

  1. Trigger: (up to you)
  2. Action: Webhooks - POST (Create Product)
  3. Action: Webhooks - POST (Create Price)
  4. Action: Webhooks - POST (Create Payment Link)
  5. Action: (up to you)

 

Zap Step: 2

Stripe API Documentation

Create a Product: https://stripe.com/docs/api/products/create

 

NOTES:

  1. There are additional configuration options per the Stripe API Documentation.
  2. For the Basic Auth field, make sure to replace the placeholder [STRIPE_API_KEY] with your Stripe API Key (TEST / LIVE).
  3. For the Data, you can set a static value or map a dynamic variable for theses parameters:
    1. name
  4. Leave all other fields as is (blank or default values).
  5. The response will return the generated Product ID that you can map to Step 3.

 

CONFIG

 

Zap Step: 3

Stripe API Documentation

Create a Price: https://stripe.com/docs/api/prices/create

 

NOTES:

  1. There are additional configuration options per the Stripe API Documentation.
  2. For the Basic Auth field, make sure to replace the placeholder [STRIPE_API_KEY] with your Stripe API Key (TEST / LIVE).
  3. For the Data, you can set a static value or map a dynamic variable for theses parameters:
    1. currency
    2. unit_amount
      1. Value in CENTS
    3. product
      1. Map from previous step
    1.  
  4. Leave all other fields as is (blank or default values).
  5. The response will return the generated Price ID that you can map to Step 4.

 

CONFIG

 

Zap Step 4

Stripe API Documentation

Create a Payment Link: https://stripe.com/docs/api/payment_links/payment_links/create

 

NOTES:

  1. There are additional configuration options per the Stripe API Documentation.
  2. For the Basic Auth field, make sure to replace the placeholder [STRIPE_API_KEY] with your Stripe API Key (TEST / LIVE).
  3. For the Data, you can set a static value or map a dynamic variable for theses parameters:
    1. line_items[0][quantity]
    2. line_items[0][price]
      1. Map from previous step
  4. Leave all other fields as is (blank or default values).
  5. The response will return the generated Stripe Payment Link URL that you can use.

 

CONFIG

 

BONUS

All 3 action steps can be combined into 1 Code step.


5 replies

Could you show please show an example of code to create a payment link from Stripe API in Wordpress and redirect the user to the response URL?

Thank you!

Userlevel 7
Badge +14

Hi @judagutor 

That would involve front end scripting, whereas Zaps utilize back end (app to app) scripting.

Userlevel 1

I can’t get this to work.  I think it has something to do with the way that I’m formatting the “Basic Auth” field.  I am just copying and pasting my STRIPE TEST SECRET KEY into the BASIC AUTH field and I get this error:

Failed to create a request in Webhooks by Zapier
The app returned "You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authenti...". You did not provide an API key. You need to provide your API key in the Authorization header, using Bearer auth (e.g. 'Authorization: Bearer YOUR_SECRET_KEY'). See https://stripe.com/docs/api#authentication for details, or we can help at https://support.stripe.com/.

 

 

 


 

Userlevel 7
Badge +14

@djryanash 

Make sure to include the trailing pipe |

 

Or try using the header as indicated

 

Userlevel 1

Wow - that solved it. Thanks.  So easy for you. :)

Reply