# Quick Start Guide source: https://developer.mastercard.com/digital-redemptions/documentation/quick-start-guide/index.md ## Overview {#overview} The Digital Redemptions service provides APIs to retrieve redeemer profiles and redemption data, create redemptions, and reverse redemptions. This tutorial guides you through onboarding and your first Sandbox call. > > ### You can follow this guide to learn: {#you-can-follow-this-guide-to-learn} > > * How to create a project for the service. > * How Mastercard Developers approaches authentication. > * How to generate your credentials and API client. > * How to make your first Sandbox call and confirm it worked. > * How to get access to Sandbox and Production. ## Prerequisites {#prerequisites} Before you start, make sure you have: * A [Mastercard Developers](https://developer.mastercard.com) account. * A tool to send signed HTTP requests: a generated API client with the Mastercard [OAuth 1.0a signer](https://developer.mastercard.com/platform/documentation/security-and-authentication/using-oauth-1a-to-access-mastercard-apis/#client-libraries) library, or a Postman or Insomnia collection with the Mastercard OAuth plug-in. * A Sandbox Client ID that Mastercard has mapped to a test Rewards program. This is a one-time manual step described in step 10 under [Generate Your Credentials](https://developer.mastercard.com/digital-redemptions/documentation/quick-start-guide/index.md#generate-your-credentials). * A test RANAC (Random Account) identifier for that program, supplied with your test data. Environment base URLs and authentication details are on the [API Basics](https://developer.mastercard.com/digital-redemptions/documentation/api-basics/index.md) page. ## Accessing The API {#accessing-the-api} 1. Navigate to [Mastercard Developers](https://developer.mastercard.com) and click sign up and create an account. 2. Activate your account by opening the link sent to your email address, and log in. ## Generate Your Credentials {#generate-your-credentials} To generate your Sandbox and Production credentials you must create a new Mastercard Developers project. Generating Sandbox credentials will give you access to our Sandbox, which has rich, mocked data, that will help you understand the API. | Authentication Method | Description | |--------------------------------------------|------------------------------------------------------------------------------------| | [OAuth 1.0a](https://oauth.net/core/1.0a/) | Each API request is signed with an RSA private key generated during project setup. | 1. Create a project on your [My Projects](https://developer.mastercard.com/dashboard) page. You can create a new project by clicking the **Create New Project** button, in the upper right portion of the screen. ![My Projects](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/myprojects.png) 2. Name your project. Enter a descriptive name for your project. ![Name project](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/configureproject.png) 3. Indicate whether you are creating a project on behalf of a client. Note: Check "yes" if you are creating an API integration project for a customer. For example, you could be an integrator, a processor, or a service provider and the customer could be a merchant, issuer, or acquirer. 4. Provide the client company name and client company address (if applicable). 5. Click on the **Select your API service** dropdown list and select the **Mastercard Digital Redemptions** option and click **Proceed** . ![Create new project](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/addnewapi.png) 6. Provide the commercial countries for the project. This field represents where your client is doing business. ![Commercial Country](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/commercialcountry.png) 7. Sandbox OAuth Credentials. * Enter the key alias and keystore password for generating the OAuth key. ![Project Credentials](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/projectcredentials.png) Note: You are required to capture the Keystore password and key alias shown on the screen. The Keystore password is used in conjunction with the .p12 file and Client ID for OAuth authentication. Click **Confirm and Continue** to complete the Sandbox setup process. * After the project is successfully created, the Sandbox .P12 access credentials will be available for download. * Click **Proceed**. 8. Generate Encryption Keys. * The encryption keys are auto-generated. The Client Encryption key will be used to encrypt the request and Mastercard Encryption key will be used to decrypt the response. ![Encryption keys](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/additionalcredentials.png) * Click **Create Project**. * Click the **Download key file** button to download a zip file containing the .p12 file required for OAuth authentication in Sandbox. ![Download signing key](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/downloadkeys.png) * After confirmation, you will receive an email confirming the provisioning request and keys. 9. Download Encryption Key. * After the sandbox environment is provisioned, navigate to **My Projects** and select your project. * Click on manage under **Client Encryption Keys** and click the **Download** to download the client encryption key. ![Production Keys APIs](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/sandboxkeys.png) * The Client Encryption key will be used to encrypt the request and Mastercard Encryption key will be used to decrypt the response. Note: **Mastercard Encryption Keys** will be automatically downloaded upon project creation. 10. Provide information to Mastercard Product Delivery or CIS Implementation manager. Once you have the consumer key, provide it to your Mastercard Product Delivery or Customer Implementation Services Implementation Manager (CIS IM). To complete this, perform the following steps: * From the Mastercard Developers project summary page, go to the Sandbox Keys section, click on the Actions dropdown button, and select the Copy Consumer key option. * Paste the Client ID value into an e-mail and send it to your Account Manager or assigned Product delivery or CIS Implementation Manager. The first 48 characters of this key value (up to the exclamation point) will be the Mastercard API Client ID, which will be used for the Sandbox environment. An example of the key value, with Client ID represented in bold **6Fmo7rEvHmVFTrv73a0m6qfUExPxMzOdY5Rs32KI09979c7f**!aea8847fa4b84b9886143a40ac117aee0000000000000000 * Once the CIS team adds the Client ID you would be able to test the APIs. * Work with your Account Manager or assigned Product delivery Manager for the test data needed for your program. This is a required step before you start testing in Sandbox. * For any questions please submit a request by clicking Get Help [here](https://developer.mastercard.com/digital-redemptions/documentation/support/index.md). ## Integrate {#integrate} ### Generate your own API client {#generate-your-own-api-client} 1. Navigate to the API documentation page. 2. Download the API specification (OpenAPI or Swagger). 3. Generate and configure an API client for this API. 4. Configure your client using our [client libraries](https://developer.mastercard.com/platform/documentation/security-and-authentication/securing-sensitive-data-using-payload-encryption/#client-libraries). For a detailed step-by-step guide, see [Generating and Configuring a Mastercard API Client](https://developer.mastercard.com/digital-redemptions/documentation/tutorials-and-guides/api-testing-tutorial/index.md). ## Make Your First Sandbox Call {#make-your-first-sandbox-call} The simplest first call is [Get Redeemer Profile](https://developer.mastercard.com/digital-redemptions/documentation/api-reference/index.md?view=api#getRedeemersProfile). It is a GET request with no request body and no payload encryption, and it returns the cardholder's points balance. Use it to prove that your credentials, signing, and Sandbox access all work before you build the checkout flow. 1. Replace `{user_id}` with the test RANAC from your test data. 2. Sign the request with your Sandbox consumer key and `.p12` signing key. The `Authorization` header below is generated by the client library; do not build it by hand. 3. Send the request to the Sandbox base URL. * Curl ```curl curl --request GET \ --url 'https://sandbox.api.mastercard.com/loyalty/redeemers/{user_id}?user_id_type=RANAC&redemption_type=MERCHANDISE' \ --header 'Accept: application/json' \ --header 'Authorization: OAuth oauth_consumer_key="",oauth_signature_method="RSA-SHA256",...' ``` A successful call returns HTTP `200` with a `RedeemerProfile` object. The fields you care about for a first check are `householdInfo.pointBalance`, `householdInfo.cashEquivalent`, and `householdInfo.currencyCode`: ```json { "userId": "243158200017148976368933017574", "userIdType": "RANAC", "accountInfo": { "accountStatus": "1", "lastFourDigitsOfCard": "0001", "programId": 10852, "programName": "Partner Program", "roundingMethod": "NATURAL" }, "householdInfo": { "householdId": "89569681", "householdRole": "P", "pointBalance": "999996", "cashEquivalent": "999997", "currencyCode": "USD", "pointsName": "Miles" } } ``` Your call worked if the status is `200`, `userIdType` is `RANAC`, and `householdInfo.pointBalance` holds a numeric string. If you receive `401`, the request signature or Client ID was rejected; if you receive `400` or `404` with `INVALID_ACCOUNT_NOT_FOUND`, the Client ID is not yet mapped to a Rewards program or the RANAC is not enrolled. See [Codes and Formats](https://developer.mastercard.com/digital-redemptions/documentation/code-and-formats/index.md) for the full list. ## Go-Live {#go-live} After you have tested your implementation in our Sandbox environments, it is time to Move to Production. ### Steps to moving to production {#steps-to-moving-to-production} 1. Request Production access. * Click the **Request Production Access** button, in the Production section of the screen. ![Request Production Access](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/requestproductionaccess.png) 2. Create a Production Key. * Enter a descriptive name for the key which identifies its purpose and environment in the `Key Alias` field. * Enter a password used to encrypt the keys that the customer will receive in the `Keystore Password` field. * Click **Update project** . ![Client Encryption Key](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/clientencryptionkey.png) 3. Confirm and Download. * Click **Download key file** to download a zip file containing the .p12 file required for OAuth authentication in Production. ![Confirm and Download Keys](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/downloadprodkeys.png) * When you click the Download key file above, a private key and Certificate Signing Request (CSR) will be generated. The CSR is uploaded to Mastercard, and you will be able to download the private key as a P12. This P12 is used to access the APIs on Mastercard Developers. * These files are generated in the browser, and only the CSR is sent to Mastercard, which ensures your private key is always private. * Once you complete this process, the Mastercard API Support team will review and approve your request for Production access. * You will receive an email from Mastercard Developers to your registered email address, depending upon the outcome of the review. Note: Typically, it takes 3-5 working days to review and approve the Digital Redemptions API Production access request. If you hear nothing after 5 working days, follow the escalation steps in [Move Project to Production](https://developer.mastercard.com/digital-redemptions/documentation/tutorials-and-guides/production-access-tutorial/index.md#if-approval-takes-longer-than-5-working-days). 4. Download Encryption Key. * After the production environment is provisioned, navigate to **My Projects** and select your project. * Click on manage under **Client Encryption Keys** and click the **Download** to download the client encryption key. ![Production Keys APIs](https://static.developer.mastercard.com/content/digital-redemptions/img/merchandise/tutorial/prodkeys.png) * The Client Encryption key will be used to encrypt the request and Mastercard Encryption key will be used to decrypt the response. Note: **Mastercard Encryption Keys** will be automatically downloaded upon project creation. 5. Provide information to Mastercard Product Delivery or CIS Implementation manager. Once you have the consumer key, provide it to your Mastercard Product Delivery or Customer Implementation Services Implementation Manager (CIS IM). To complete this, perform the following steps: * From the Mastercard Developers project summary page, go to the Production credentials section, click on the copy symbol next to Consumer Key to copy the consumer key. * Paste the Client ID value into an e-mail and send it to your Account Manager or assigned Product delivery or CIS Implementation Manager. The first 48 characters of this key value (up to the exclamation point) will be the Mastercard API Client ID, which will be used for the production environment. An example of the key value, with Client ID represented in bold **6Fmo7rEvHmVFTrv73a0m6qfUExPxMzOdY5Rs32KI09979c7f**!aea8847fa4b84b9886143a40ac117aee0000000000000000 * Once the CIS team adds the Client ID you would be able to test the APIs. * Work with your Account Manager or assigned Product delivery Manager for the data needed for your program. This is a required step before you start testing in Production. * For any questions please submit a request by clicking Get Help [here](https://developer.mastercard.com/digital-redemptions/documentation/support/index.md). ## Next Steps {#next-steps} Now that you have made your first call, proceed to the [Use Cases](https://developer.mastercard.com/digital-redemptions/documentation/use-cases/index.md) section to learn about the different use cases of the service, then follow [Integration and Testing](https://developer.mastercard.com/digital-redemptions/documentation/integration-and-testing/index.md) to test the full checkout flow. When your Sandbox testing is complete, follow [Move Project to Production](https://developer.mastercard.com/digital-redemptions/documentation/tutorials-and-guides/production-access-tutorial/index.md).