Attribution
3 min read
Payment links can be associated with a particular customer.
This can be set in two ways:
- Set the customer's email within the payment link receiver field
- Pass a query string parameter for
customer_email
orcustomer
Setting customer email
Within the link builder, you will see a receiver field where you can specify the intended customer's email address.
When a valid email address is set here, the email address field within any checkout session created from clicking on the related payment link, will be prefilled.
This has 2 benefits:
- Your customer doesn't have to enter their own email address.
- The receiver email field for any sales from this link is locked.
- This means sellers have confidence that a sale belongs to a particular customer, that they were aware of prior to checkout.
Query string params
Sellers can pass two values to control receiver attribution via query string params:
customer_email
- This can be any valid email address
customer
- This must be a Stripe customer id which you know for your targeted customer
Note: if the customer param is used but no customer can be found for the id value passed, then the link will show an error which says "No such customer".
Examples
Here's an example where the customer_email
parameter is used.
https://priceblocs.com/test/links/_bLNfgxub3XDMr-y-thdR?customer_email=shane@priceblocs.com
Here's an example where the customer
parameter is used.
https://priceblocs.com/test/links/_bLNfgxub3XDMr-y-thdR?customer=cus_JL9GOPrwTibShZ
Note: when the customer parameter is passed the email field will be prefilled with the email value on file for that customer, but the field will be editable, unlike when the customer_email parameter is passed
Order of specificity
Values
Any values set in the payment link will override passed query string params, and this includes receiver information.
For example, if you have a:
customer_email
set within payment link- but also pass
customer_email
as a query string param
Then the payment link value will be used, as it ranks higher in the order of specificity.
Parameters
customer
ranks higher than customer_email
in order of specificity.
This means that if you try to:
- pass both
customer
&customer_email
as query string params - on a payment link where no receiver value has been set
- then the
customer
value will be used over thecustomer_email
.
Here's an example of that, where the customer_email
parameter is overridden by the customer
parameter.
https://priceblocs.com/test/links/_bLNfgxub3XDMr-y-thdR?customer=cus_JL9GOPrwTibShZ&customer_email=shane@priceblocs.com