How to implement gifting in your checkout

By Michal Dobrzynski, 06 Nov 2017, in guide, product

Generous customers want to purchase your software as a gift for a friend or relative? This gifting mechanic is not very hard to implement on top of our platform. Just follow this step by step guide which will run through:

  1. The buyer experience, with custom pre-checkout / post-checkout
  2. The order fulfilment via webhook
  3. The creation of a personalised coupon
  4. The email to the gift recipient, on the right date

There are 2 main requirements you need to take into account:

  • The product you set up via our dashboard must use the “webhook” fulfilment option, as you’ll be delivering the product to the gift recipient rather than the person who paid for it
  • You’ll need to handle the emails to the gift recipient yourself

The buyer experience

You need to collect a couple of details before you call the Paddle checkout:

  • The date when the gift recipient should get notified and receive their present
  • The name and email of the gifter
  • The name and email of the lucky gift recipient

In this example we’ll use the Paddle.js overlay checkout - although the same logic would apply to an inline checkout.

You’re going to collect these details in your own form, then hand them over to our checkout via the Paddle.js passthrough: this will allow you to process them in your fulfillement webhook in the next stage.

Here’s an example, with the source code:

We simply use a couple of lines of Javascript to pass the form data to the checkout when the customer clicks “Buy now”:

// Capture the pre-checkout form values to pass to the Paddle checkout
$('#js-buy').on('click', function(e) {
  var passDict = {
    'Sender Name' : $('input[name="fromInputName"]').val(),
    'Sender Email' : $('input[name="fromInputEmail"]').val(),  
    'Recipient Name' : $('input[name="toInputName"]').val(),
    'Recipient Email' : $('input[name="toInputEmail"]').val(),
    'Send Date' : $('input[name="giftDate"]').val()
  };
  var passString = JSON.stringify(passDict);

  //Call the Paddle checkout
  Paddle.Checkout.open({
    product : 518627,
    email : $('input[name="fromInputEmail"]').val(),
    passthrough : passString,
  });
});

Notice that we also pass the gifter’s email to the checkout - saving them the need to enter it again.

The gifter will then proceed to the Paddle checkout, and pay for the software as usual.

Order fulfilment via webhook

Once the customer has finished paying for the product they want to gift, you will receive a notification from us using the webhook, whose payload will include your pre-checkout custom fields. For example:

{
  p_order_id: 2233650
  p_currency: USD
  p_quantity: 1
  passthrough: {"Sender Name":"Marty McFly","Sender Email":"d.lorean@mcfly.com","Recipient Name":"Mitch Buchannon","Recipient Email":"mitch@buchannon.com","Send Date":"2017-11-06"}
  p_signature: qB8BQXWXS/24Bv61FHchD4tmTKxGVOjyeZr4c47O2+5dvtWBGLSJKcE2b5rZH14MapeZUad+K6XrRQIdCcD675RaqFexaDAWSTKeWKgjJg7jIfnlbExCxL1UcMl24inFvSfY4w8LR0kfFDudG68FPmxlDcHXxYm+Wk2RCxFKe7KXEObnXRM7
  p_product_id: 520008
  quantity: 1
}

Find out more about using and verifying webhooks.

Creation of a personalised coupon

The gift recipient will receive a unique, one use coupon which will let them redeem your product without having to pay.

Creating such coupons ahead of time would be painful: this is why you should use our Coupon API to dynamically create the coupon on the fly, once you’re received the webhook.

curl -X POST \
https://vendors.paddle.com/api/2.1/product/create_coupon \
-F vendor_id=12345 \
-F vendor_auth_code=1234567 \
-F coupon_prefix=GIFT \
-F num_coupons=1 \
-F 'descriptions=API Coupon' \
-F coupon_type=product \
-F product_ids=520008 \
-F discount_type=percentage \
-F discount_amount=100 \
-F group=Gifts \
-F allowed_uses=1

You can learn more about our Coupon API here.

This API call accomplishes a couple of things:

  • You ask for the coupon to start with the “GIFT” prefix, and let Paddle handle the rest of the coupon’s name - which will return e.g GIFT7DHDLDL
  • You discount 100% of the product
  • You restrict its use to one time, for the specific product that your customer bought
  • You mark it as part of the “Gift” group, which will neatly file it in its dedicated section in our dashboard

The API will return the coupon code.

Thank the gifter

Instead of delivering the software the gifter bought, you can just email them a thank you note - or use a custom post-checkout confirmation page, using our post-checkout API.

This allows you to display a confirmation page that you can entirely design and customize, displaying for example:

  • A receipt (this can have a really nice touch with a personal thank you note - or even a surprise discount coupon to reward them for being generous)
  • The details of the gift recipient
  • When they will receive their present

Deliver the gift

You then send an email to the gift recipient, at the date specified by the gifter, explaining why they’re receiving a free product and including the redemption instructions and their unique coupon.

You can use a transactional email service such as Postmark or SendGrid.

We recommend to direct them to a simple redemption page that only displays the gifted product, to minimize any friction or confusion.

To save them the need to copy/paste you can even go one step beyond and tag https://yourwebsite.com?coupon=GIFT7DHDLDL with your actual coupon at the end of the link to your website: we will automatically match that coupon to any checkout opened on that page, as long as the coupon is available for that product.

In summary

This gifting implementation showcases several parts of our solution, from the ability to collect any custom information in a pre-checkout UI to the flexibility of dynamic coupon creation.

To recapitulate the whole flow:

  1. The gifter purchases the product and reaches a custom success page thanking them
  2. Upon that purchase, a fulfilment webhook is called
  3. Upon receipt of that webhook, you create a coupon using our Coupon API, which will be sent to the gift recipient
  4. On the gifting date, you email the gift recipient with the coupon and the redemption details
  5. The lucky recipient redeems their gift on our checkout, for free

I hope this is helpful, whether you want to make it part of your usual checkout or intend to use it as a limited campaign around Black Friday or Christmas for example… As usual if you need help or advice with this, don’t hesitate to reach out to us!

We think you may also like..

The Complete Guide to Black Friday for Software Businesses

By Octave Auger, 21 Nov 2017, in guide, Black Friday

Black Friday and Cyber Monday are some of the biggest software e-commerce days of the year, with an estimated 55% of US customers expected to take part by purchasing a hardware gadget or a software product.

To make the most out of these key dates you'll need to combine the right offer with the right messaging and the right marketing channels, which is why we've assembled a list of tips and ideas for you.
Read more

Our new Pricing API improves the way you can display prices

By Rob Hudson, 20 Nov 2017, in product

We've just introduced our Pricing API to let you retrieve, localize and calculate prices on the fly.
Read more