Skip to main content
All CollectionsDeveloper Docs & Advanced Options
Creating Gift Cards with Custom Amounts
Creating Gift Cards with Custom Amounts

You may want to programmatically create a gift card with a specific amount without requiring the customer to do so.

Updated this week

If the gift card with custom amount is being sent as a gift, see the article Creating a Custom Gifting Flow which provides additional context.

When adding a gift card to the cart with a custom amount using line item properties, specify this value in the presentment currency using the format:

_givy_custom_amount=100.00

On stores with multiple currencies, Givy will assume that the amount is provided in the store's presentment currency if only one amount is provided.

If you're not familiar with presentment currency, this means the price of the product in the currency the customer is currently shopping in. Using Javascript, you can determine the presentment currency using:

(<shop amount> * window.Shopify.currency.rate).toFixed(2)

Where <shop amount> is the amount or price in your store's default currency.

If you would like the gift card to create a specific amount in the shop's currency, you may add an optional shop currency value to this attribute in the format:

_givy_custom_amount=<presentment currency amount>,<shop currency amount>

For example, for a USD store selling a $100USD gift card in CAD, with an exchange rate of 1.3 CAD for 1.0 USD, you would specify

_givy_custom_amount=130.00,100.00

When both values are provided, the amount customers see on the product page will remain the same all the way through to checkout, and the gift card will be created in the amount specified as the <shop currency amount>.

In the example above, the customer will see a $130CAD gift card in the cart and at checkout, and Givy will create a gift card with a value of $100USD.

Finding the Custom Amount Variant

To create a gift card with a custom amount, you'll need to add the correct variant to the cart. To find this variant, find and open the gift card product in your Shopify admin, then click on the "Custom" variant to bring up the variant editor.

In the address bar, you will see the variant ID at the very end. This is the variant which must be added to the cart when using the _givy_custom_amount property.

Did this answer your question?