Overriding Checkout Prices

It may be useful to override the price of the checkout on the fly when building custom experiences.

When building custom checkout experiences, adding upgrade pricing etc… it may be helpful to override the checkout price, rather than using a coupon or other method. To prevent prices being tampered with in Checkout URLs, we use a simple price token authentication system to secure these.

1. Required Data

In order to override a checkout price, you’ll need:

  • The amount you wish to override the product to (in the products base currency).
  • The “Checkout Secret Key” for the product. (This can be found by clicking on the ‘Checkout Link’ button next to the Product/Subscription in your Paddle Dashboard).

2. Overriding the Price

There are two primary ways of opening a Paddle Checkout, via the recommended method using Paddle.js, or by directing a user to the Checkout URL directly.

The process of authenticating the prices for each of these methods is the same, but the implementation is slightly different.

Generating the Authentication Token

For both methods, you’ll need to generate the price authentication token. To do this, simply MD5 hash the new product price with the ‘Checkout Secret Key’ from your dashboard above.

In PHP for example, you may do:

<?php
  $newPrice = '30.00';
  $checkoutSecretKey = 'abc123';
  
  $priceAuthentication = md5($newPrice.$checkoutSecretKey);
?>

Using Paddle.js

When Using Buttons

  • Pass your new price as the data-price button attribute.
  • Pass your generated price authentication token as data-auth.
<button class="paddle_button" data-product="1234567" data-price="30.00" data-auth="c91d2e54d5c85970a9c3e5c146f0d053">Buy Now</button>

When Invoking Checkouts with Javascript

  • Pass your new price as price in your checkout object.
  • Pass your generated price authentication token as auth in your checkout object.
  • If working with subscriptions price will set / override the trial / setup price, not the recurring price.
<script type="text/javascript">
Paddle.Checkout.open({
	product: 1234567,
	price: '30',
	auth: 'c91d2e54d5c85970a9c3e5c146f0d053'
});
</script>

When Overriding Multiple Currencies with Javascript

<script type="text/javascript">
Paddle.Checkout.open({
    product: 508649,
    prices: [
        {
            currency: 'USD',
            price: '5.00',
            auth: '0a1b2c3d4e5f6g7h8i9j10k'
        },
        {
            currency: 'EUR',
            price: '5.00',
            auth: '0a1b2c3d4e5f6g7h8i9j10k'
        },
        {
            currency: 'GBP',
            price: '5.00',
            auth: '0a1b2c3d4e5f6g7h8i9j10k'
        }
    ]
});
</script>

When Overriding Recurring Prices with Javascript

<script type="text/javascript">
Paddle.Checkout.open({
    product: 508649,
    recurringPrices: [
        {
            currency: 'USD',
            price: '10.00',
            auth: '0a1b2c3d4e5f6g7h8i9j10k'
        },
        {
            currency: 'EUR',
            price: '10.00',
            auth: '0a1b2c3d4e5f6g7h8i9j10k'
        },
        {
            currency: 'GBP',
            price: '10.00',
            auth: '0a1b2c3d4e5f6g7h8i9j10k'
        }
    ]
});
</script>
  • Pass your new price as price in your checkout URL.
  • Pass your generated price authentication token as auth in your checkout URL.
https://checkout.paddle.com/checkout/product/12345667?price=30&auth=c91d2e54d5c85970a9c3e5c146f0d053
Was this page helpful?