> ## Documentation Index
> Fetch the complete documentation index at: https://docs.slm.m1amdocs.com/llms.txt
> Use this file to discover all available pages before exploring further.

# Determining Redemption Credit Amount

Subscribe redeems Gift Cards for Token credit associated with a Product object.

When a customer offers a Gift Card PIN for redemption, Subscribe contacts your gift card processor to redeem the card, and the processor returns a SKU or a UPC number if the card is valid. This SKU or UPC must match the `merchantProductId` of a `Product` object that you have previously created in Subscribe. When you create the `Product`, use the `creditGranted` data member to associate a number of Token credits with it, which will be granted to the Account or AutoBill upon redemption of the associated Gift Card.

To redeem a Gift Card:

1. Subscribe sends the Gift Card number (as defined by you and your gift card processor, and presented by your customer) to your gift card processor.
2. Your card processor validates that the Gift Card associated with the number is still active.
3. Upon validation, your Gift Card processor returns a SKU or UPC number to Subscribe.
4. Subscribe matches this SKU to a Product’s `merchantProductId` (or SKU).
5. If a match is found, the Token credits associated with the Product are granted to the Account or AutoBill.

Before accepting gift cards, work with your gift card processor to define the SKU or UPC your processor will return for each type of gift card you accept, and create `Product` objects with the corresponding `merchantProductId` in Subscribe.

The following example creates a new `Product` object that grants token-based credit (5000 tokens of type `'STARWARS_POINTS'`). The `merchantProductId` of this `Product` matches the SKU/UPC the processor returns when a \$10 gift card is redeemed.

```

 $product = new Product(); 
  
 // Identify the product by your unique identifier
 // This should be the SKU/UPC returned by gift card processor
  
 $product->setMerchantProductId('49238434023383'); 
  
 $product->setStatus('Active'); 
 $product->setDescription('Redeem product for ten dollar gift'); 
  
 // define the credit that this product will grant
 $tok = new Token();
  
 $tok->setMerchantTokenId('STARWARS_POINTS');
  
 $tokAmt = new TokenAmount();
 $tokAmt->setToken($tok);
 $tokAmt->setAmount(5000);
  
 $cr = new Credit();
 $cr->setTokenAmounts(array($tokAmt));
  
 // Set the credit into the product
  
 $product->setCreditGranted($cr);
  
 // Now make API call to create the product
  
 $response = $product->update(DuplicateBehavior::SucceedIgnore); 
 if($response['return Code’] == 200 && $response['created']) { 
 $createdProduct = $response['data']->product; 
 print "Created product with VID " . $createdProduct->getVID(); 
 }
```

**Parent topic:**[Working with Gift Cards](../topics/Working_with_Gift_Cards)


This documentation is built and hosted on [Mintlify](https://mintlify.com), a developer documentation platform.