Gift subscription
You can include a feature in your application that enables users to gift subscriptions to others. This can help boost revenue and attract new users.
How it works
A user can gift a subscription to an existing user in your system by specifying their account information or to a new user by specifying their email address. In this case, the user sending the gift can hide their name or add a text message to the gift email notification. After creating a subscription, the gift recipient becomes its owner. The created subscription is of the one-time payment renewal type.
Interaction flow when gifting a subscription to an existing user:
Interaction flow when gifting a subscription to a new user:
How to set it up
You can set up the ability to gift a subscription in your app:
Gift to an existing user
- Implement in your application an interface for purchasing a gift subscription with the following elements:
- fields for entering data of the gift recipient
- field for entering a message from the sender (optional)
- option to select anonymous sending (optional)
- elements for selecting a subscription plan (optional)
- Implement receiving a token after filling in the gift details when proceeding to the payment. To do this, pass the
purchase.subscription.gift
object to the Create token API call with the following parameters:recipient
— ID of the subscription recipient. Required.email
— recipient’s email address. Required.redirect_url
— redirect URL. Provide a link to a page with additional information about the gifted subscription or to the main page of the project.
redirect_url
is not passed in the token, the gift recipient will not be able to navigate to the gifted subscription from the gift notification email.- Additionally, you can pass the following parameters in the
purchase.subscription
object:gift.anonymous
— whether the gift was sent anonymously. Iftrue
, the sender’s name is hidden in the email notification. Defaults tofalse
.gift.message
— message from the sender of the gift. Sent in an email notification of the gifted subscription.plan_id
— subscription plan ID.
Example of a request to receive a token:
- javascript
{
"purchase": {
"checkout": {
"currency": "USD",
"amount": 10
},
"subscription": {
"gift": {
"recipient": "test_recipient_v1",
"email": "recipient_email@email.com",
"redirect_url": "https://example.com/",
"anonymous": true,
"message": "Happy birthday!"
}
}
},
"settings": {
"currency": "USD",
"language": "en",
"project_id": 16184,
"ui": {
"components": {
"virtual_currency": {
"custom_amount": true
}
},
"desktop": {
"virtual_item_list": {
"button_with_price": true,
"layout": "list"
}
},
"size": "medium"
}
},
"user": {
"country": {
"allow_modify": true,
"value": "US"
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"id": {
"value": "user_2"
},
"name": {
"value": "John Smith"
}
}
}
- Using the token received in step 2, open the payment interface in a new window, in an Iframe, or using Pay Station Embed.
Gift to a new user
- Implement in your application an interface for purchasing a gift subscription with the following elements:
- fields for entering the email address of the gift recipient
- field for entering a message from the sender (optional)
- option to select anonymous sending (optional)
- elements for selecting a subscription plan (optional)
- Implement the new user creation and assign an ID to it in your system.
- Create a link to activate the user account.
- Implement receiving a token after filling in the gift details when proceeding to payment. To do this, pass the
purchase.subscription.gift
object with the parameters to the Create token API call:recipient
— the subscription recipient ID created in step 2.email
— recipient’s email address.redirect_url
— activation URL created in step 3.
redirect_url
is not passed in the token, the gift recipient will not be able to navigate to the gifted subscription from the gift notification email.- Additionally, you can pass the following parameters in the
purchase.subscription
object:gift.anonymous
— whether the gift was sent anonymously. Iftrue
, the sender’s name is hidden in the email notification. Defaults tofalse
.gift.message
— message from the sender of the gift. Sent in an email notification of the gifted subscription.plan_id
— subscription plan ID.
Example of a request to receive a token:
- javascript
{
"purchase": {
"checkout": {
"currency": "USD",
"amount": 10
},
"subscription": {
"gift": {
"recipient": "test_recipient_v1",
"email": "recipient_email@email.com",
"redirect_url": "https://example.com/",
"anonymous": true,
"message": "Happy birthday!"
}
}
},
"settings": {
"currency": "USD",
"language": "en",
"project_id": 16184,
"ui": {
"components": {
"virtual_currency": {
"custom_amount": true
}
},
"desktop": {
"virtual_item_list": {
"button_with_price": true,
"layout": "list"
}
},
"size": "medium"
}
},
"user": {
"country": {
"allow_modify": true,
"value": "US"
},
"age": 19,
"email": {
"value": "john.smith@mail.com"
},
"id": {
"value": "user_2"
},
"name": {
"value": "John Smith"
}
}
}
- Using the token received in step 4, open the payment interface in a new window, in an Iframe, or using Pay Station Embed.
Found a typo or other text error? Select the text and press Ctrl+Enter.