Fill in the form to arrange a demo

Overriding Checkout Prices

It may be useful to override the price of the checkout in order to build custom checkout experiences.

When building custom checkout experiences, such as to provide upgrade pricing, it may be useful to override the checkout price, rather than using a coupon or other method.

You can do this by generating a unique checkout URL using the Custom Checkout API and passing in prices to override the initial checkout price or recurring_prices if you wish to override a subscription’s subsequent recurring payment amount. See the examples below for usage of these parameters.

PHP Example


<?php
    $data['vendor_id'] = 123;
    $data['vendor_auth_code'] = '456bd...';
    $data['product_id'] = 123456;
    
    // Here we are overriding the prices for multiple different currencies. For subscription products, this will override the initial checkout price only.
    $data['prices'] = [
		'USD:10',
		'GBP:12',
		'EUR:9.5'
	];
  
    // Subscription products only - here we are overriding the recurring prices for multiple different currencies.
    $data['recurring_prices'] = [
		'USD:9',
		'GBP:10',
		'EUR:8.9'
	];
    
    // Here we make the request to the Paddle API
    $url = 'https://vendors.paddle.com/api/2.0/product/generate_pay_link';
    $ch = curl_init($url);
    curl_setopt($ch, CURLOPT_POST, true);
    curl_setopt($ch, CURLOPT_RETURNTRANSFER, true);
    curl_setopt($ch, CURLOPT_POSTFIELDS, http_build_query($data));
    $response = curl_exec($ch);
    
    // And handle the response...
    $data = json_decode($response);
    if ($data->success) {
        echo "Success! Checkout URL:" . $data->response->url;
    } else {
        echo "Your request failed with error: " . $data->error->message;
    }

Bash Example



curl -X POST \
     -d 'vendor_id=123' \
     -d 'vendor_auth_code=456bd...' \
     -d 'product_id=123456' \
     -d 'prices[0]=USD:10' \
     -d 'prices[1]=GBP:12' \
     -d 'prices[2]=EUR:9.5' \
     -d 'recurring_prices[0]=USD:9' \
     -d 'recurring_prices[1]=GBP:10' \
     -d 'recurring_prices[2]=EUR:8.9' \
     -https://vendors.paddle.com/api/2.0/product/generate_pay_link

Example Response

{
    "success": true,
    "response": {
        "url": "https://checkout.paddle.com/checkout/custom/eyJ0IjoiUHJvZ……"
  }
}

The generated checkout URL can be displayed as an overlay with Paddle.js using the override parameter. Please click here for instructions on how to do this.

Questions about Paddle?

If you need any help regarding your Paddle integration, please get in touch with our Customer Success team using the form below.

Questions about Paddle?