The Ifeelgoods API also enables you to generate printable e-cards that you can deliver directly to your end-users. This generated PDF, approved by the brands, contains all the information required for your customers to use their e-cards in store or online when appropriated, and can be branded to your colors.

This feature does not require you to integrate another API method but simply needs you to change the media type you expect the Ifeelgoods API to return. Instead of asking for application/json in the Redeem or in the Create and Redeem methods, ask for application/pdf and you'll be done!

Let's take the exact same request as described in the Quickstart with the correct Accept header value.

curl 'https://api-sandbox.ifeelgoods.com/fulfillment/v2/promotions/790/rewards/GAP-GAP-001/redemptions/actions/redeem' \
    -H 'Accept: application/pdf' \
    -H 'Content-Type: application/json' \
    -H 'API-Key: 2e7444c93f0d4e65285ca03ac16c27600b53f09b87cfe1ded4ccd23bf94fca32' \
    -H 'API-Secret: 7f62b4c0cde13c5aced14219af34b255451eb680812056015ecaade93f32dbad' \
    -d '{ "data": { "user": { "email": "[email protected]" }, "order_id": "ifg4dev" } }' 

This will return the PDF as a binary octet stream. From here, you can store the response in a file or attach it to an email to make your customer enjoy it !

585