> ## 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.

# Redeeming a Gift Card

Redeeming a gift card is a two-step process. First, check whether the gift card is redeemable by calling the `GiftCard` object’s `statusInquiry()` method. If the call shows that the status of the gift card is \\`Active`, you may redeem the gift card.

Determine the status of a Gift Card:

```

 $gc = new GiftCard(); 
  
 // set the PIN provided by the customer
 $gc->setPin('683092298403'); 
 $gc->setPaymentProvider('your gift card processor');
  
 // Now make API call to inquire about the status of the gift card
  
 $response = $gc->statusInquiry(); 
 if($response['return Code’] == 200) { 
 // The API call is successful. Now check the
 // status in the updated GiftCard object returned by
 // this call
  
 $updatedGc = $response['data']->giftcard; 
 $status = $updatedGc->getStatus(); 
  
 // the status thus obtained is an object of type GiftCardStatus
 // Now check if it says the gift card is redeemable
  
 if ($status->getStatus() == 'Active') {
 // The gift card is redeemable, retrieve its VID
 // so we can reference it just by VID when we redeem it
  
 $gcVID = $updatedGc->getVID();
 }
 else {
  
 // Gift card is not redeemable. Inform the customer here
 // You may want to include the response received from the 
 // gift card processor
  
 $responseCode = $status->getProviderResponseCode();
 $responseMsg = $status->getProviderResponseMessage();
 }
 }
```

After determining the status of the gift card, you may redeem the card. Both `AutoBill` and `Account` objects support `redeemGiftCard` calls. When `redeemGiftCard` is successful, the credit granted by the `Product` (with `merchantProductId` returned by the gift card processor in response to this call) is added to the `Account` or `AutoBill` object against which the call was made.

Redeem a Gift Card, and add credit to an AutoBill:

```

 $abill = new AutoBill();
  
 // autobill id for a customer's existing subscription
 // the customer wants to redeem a gift card and add credit
 // to this autobill
  
 $abill->setMerchantAutoBillId('SBCR312345');
  
 $gc = new GiftCard(); 
  
 // set the VID of the gift card, obtained when the status
 // status of the gift card was checked, and determined to be active
  
 $gc->setVID($gcVID); 
  
 // Now make the SOAP API call to redeem the gift card
  
 $response = $abill->redeemGiftCard($gc);
  
 if ($response[’returnCode’] == 200) {
  
 // Redemption successful. Check if credit was added
 // to the autobill
  
 $updatedABill = $response['data']->autobill;
  
 $availableCredits = $updatedABill->getCredit();
 $availableTokens = $availableCredits->getTokenAmounts();
  
 print "Available token credits: \n";
 foreach($availableTokens as $tkAmt) {
 print "Token type: " . $tkAmt->getMerchantTokenId() . " ";
 print "Amount: " . $tkAmt->getAmount() . "\n";
 }
  
 // Also make sure status of the gift card is 'Redeemed'
  
 $updatedGc = $response['data']->giftcard;
  
 print "Status of the gift card: ";
 print $updatedGc->getStatus()->getStatus() . "\n";
 }
 else {
 // Error while granting credit to the account
 print $response['returnString'] . "\n";
 }
```

**Note:** Subscribe allows only full redemption of a gift card. You may not partially redeem a gift card.

**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.