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.
In order to override a checkout price, you’ll need:
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.
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.
For example, you can do:
<?php
$newPrice = '30.00';
$checkoutSecretKey = 'abc123';
$priceAuthentication = md5($newPrice.$checkoutSecretKey);
?>
# New price of 30.00, secret key of abc123
md5 -s '30abc123'
# New price of 19.99, secret key of abc123
md5 -s '19.99abc123'
When Using Buttons
data-price
button attribute.data-auth
.<button class="paddle_button" data-product="1234567" data-price="30.00" data-auth="c91d2e54d5c85970a9c3e5c146f0d053">Buy Now</button>
When Invoking Checkouts with Javascript
price
in your checkout object.auth
in your checkout object.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>
price
in your checkout URL.auth
in your checkout URL.https://checkout.paddle.com/checkout/product/12345667?price=30&auth=c91d2e54d5c85970a9c3e5c146f0d053