Identify customers, products and sales with query parameters

In some payment setups you will want to be able to identify data of a successful charge in your own system. You might want to save the payment to one of your users or save the products your customer paid for. The query parameter feature allows you to do so.

By adding a Return URL to your page settings and adding query parameters when you link to your Page, Checkout Page simply appends these query parameters to the Return URL when the customer is being redirected to it. This allows you to use those parameters on your own website.

Let's walk through the scenario of identifying which of your users paid you through Checkout Page.

1. Find the best way to identify your users

In most applications, each user will have their own unique identifier (id, userId, _id). If your users are not saved this way, find another way to identify your users. You could use their email address, phone number or an oAuth token. Anything that's uniquely tied to a single user works.

2. Add a Return URL in your Page settings

Go to the settings of the page you want to identify your users. There you will have to add a Return URL. After a successful payment, the customer will be redirected to this Return URL. This could be a "thank you" or "success" page, such as https://mywebsite.com/success.

Now copy the url of your Page, e.g. https://checkoutpage.co/checkout/5aaa701149321a00145c99b9/the-selling-on-checkout-page-handbook.

When you link to this URL, you can add the identifier you found in step 1. Your query parameter could look like this: ?userId=101, userId being the name of the parameter and 101 being the identifier of your current user. If you want to add multiple query parameters, you can add them with a &, like ?userId=101&productId=110.

The full URL would now look like https://checkoutpage.co/checkout/5aaa701149321a00145c99b9/the-selling-on-checkout-page-handbook?userId=101&productId=110.

4. Do something with the query parameters on your Return URL page

After a payment succeeds, we will link the customer back to your Return URL. With the past examples, this could look like https://mywebsite.com/success?userId=101&productId=110. Here you can extract those parameters using the technology of your choice and save details of the payment in your database.

Need more help?

Contact us via the Chat in the bottom-right corner or via email on info@checkoutpage.co