Purchase a gift subscription for someone
To implement this, you need to create the Address where you will be sending the gift subscription and add it to yourself by putting in your customer_id
in the request URL like this:
POST /api/customers/<your customer_id here>/addresses
More details on creating an address here
Now comes the part where you actually create the gift subscription and attach it to the Address created in the previous step. Follow this guide.
Let’s say you would want to create a 3-month gift subscription, this is how you need to set up the parameters specified, other parameters can be set to whatever you want them to be:
{
[...]
"order_interval_unit": "month",
"order_interval_frequency": "1",
"number_charges_until_expiration": 1,
"charge_interval_frequency": "3"
[...]
}
Make sure to also set the price
parameter to 0.
So now you have a 3 month prepaid subscription with YOUR PAYMENT_TOKEN
attached to it.
To give your giftee the possibility to continue the subscription you would need to custom code a solution where your customer will be notified when his gift subscription expires, and send them a link that contains info on what subscription he already had which will redirect him to our checkout. Here you can use AJAX to pull the product from the URL and add it directly to the cart. More details here.
Customer will enter his credentials, thus creating a customer, address, and a new subscription with his own payment_token
.
This will completely detach the giftee from the gifter and his payment_token
.
If you don’t want the customers to be able to continue the subscription, you don’t have to do anything after creating the subscription, as it will auto-expire thanks to the
number_charges_until_expiration
parameter.
Updated almost 2 years ago