# Call Donate - Add User API source: https://developer.mastercard.com/donations/tutorial/how-to-access-sandbox-environment/call-adduser-api/index.md ## How to call Donate - Add User API {#how-to-call-donate---add-user-api} This section provides guidelines to call Donate - Add User API (`/donations/donors`), which enrolls cardholders into your donations program to allow them to make donations with a card-on-file without having to type in personal information and credit card information each time they donate. Note that the **Add User API** accepts encrypted request payload and respond back with encrypted response payload because it contains PII (Personally identifiable information) data. Let us now call the API in the Insomnia tool: 1. Add a new request by selecting **New Request** in the request dropdown menu. 2. Name the request as 'Add User' and choose the HTTP method as **POST** and Request body as **JSON** . ![Add User API Call](https://static.developer.mastercard.com/content/donations/documentation/images/insomnia-20.png "Add User API Call") 3. In the request URL field, input the endpoint URL as `{{host}}/donations/donors` which turns to be `https://sandbox.api.mastercard.com/donations/donors` ![Add User API Call](https://static.developer.mastercard.com/content/donations/documentation/images/insomnia-21.png "Add User API Call") 4. The request payload without encryption looks like this: ```json { "userName":"John.Doe@mail.com", "name":{ "lastName":"Doe", "firstName":"John", "honorificPrefix":"Mr.", "honorificSuffix":"Junior" }, "title":"Doctor", "userType":"Online", "locale":"en-us", "timezone":"UTC-06:00", "password":"P@55w0rd", "emails":[ { "type":"home", "value":"John.Doe@mail.com" } ], "phoneNumbers":[ { "type":"home", "value":"+918983728857" } ], "addresses":[ { "type":"home", "address1":"2200 Mastercard Blvd", "address2":"123 Picket Fence Lane", "streetAddress":"2200 Mastercard Blvd", "locality":"O'Fallon", "region":"MO", "city":"O'Fallon", "country":"dd", "postalCode":"63368" } ], "acceptedConsents":{ "tncVersion":"TC.##r#12.en-us.99.99", "privacyNoticeVersion":"PN.2-#-xr.en-us.99.01", "marketingEmailSubscribed":"Y" } } ``` 5. After encryption, using libraries from step 4, the request payload looks like this: ```JSON { "encryptedValue": "SZoPa6HfG8mq2ODjd4N1L3MZk/4U3RUUXDfOfjb5N+aa0dJkT0HAU1k4Oc6x2bhQsmzIW2RSJdWnwO+3UOqOYk6WHg9Im69Cwf1LvHybk0Fbz8ukd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f/+ZWcdWWjljNnelql3MUVStV0XxDddEHN21L951VGWqiYsWdubN/xuyywoiYOgV1R/KA6IXxI+3HkSOHGIFrmwi/h9JBeIAZJoLDf142nb90dio9UuptF0e3nFrIQ==", "publicKeyFingerprint": "0bb74413121a3ca82604bd4f49830160490fe4658b382322d163e12dd60bbfa4" } ``` 6. Paste the encrypted request payload in Insomnia Request Payload JSON section. ![Add User API Call](https://static.developer.mastercard.com/content/donations/documentation/images/insomnia-22.png "Add User API Call") 7. Call the API. A successful response returns the `HTTP 200 Created` status and an encrypted response payload. ![Add User API Call](https://static.developer.mastercard.com/content/donations/documentation/images/insomnia-19.png "Add User API Call") 8. The encrypted response payload looks like this: ```JSON { "encryptedValue":"rELKIyWTh/xA+Z5oSbrf01S+/VANqvFPNKE6aBnAUlNbMcy0dAeLMwLRuJDQ1/5iX/aDF350+GMEkiGwE3J7WxN6HQWDualtvlihbJSI2I9Tn5TttSvpgkQux2COul8e", "iv":"IuoYGTOcH6nuOB3i9hCbXA==", "encryptedKey":"YJFn4hiQP24fA4ViUvQkNqPCTwFRYSmPuxr8aGc88oXq7R1HXWBypH3zMQUNAIftFPCXaeJmQsnW+aKkRDFP/t9LitudsnWlZGLQJKiC/0nIhNt5YB8/4SVtCs0dX1e958bcpIBBuiyxv4JnXK+5h+Aag42qr+a9XhtyV0Z5KCZvAAT8m3reXNQaVB/hz7M3R707tqVLiVlPFdBlVsHrIEzboU2O5g90IS6H0aEktFmGUO53hQzwX6SW6ze3HbEPjyXXDQn+IZjXh2KG+1JK9EAdFCdGSjOX11AvkYlS905y30UQYXtT6KLhzy3N7wYeaR1b1tuClUjhSkEE/2Xk9A==", "publicKeyFingerprint":"643a5963a8092827ba3783d5ee31c214b99c53e8a58a4c8654b2e204c010cb13", "oaepPaddingDigestAlgorithm":"SHA256" } ``` 9. After decryption, using the libraries from step 4, the response payload looks like this: ```JSON { "oaepPaddingDigestAlgorithm":"SHA256", "donorId":"381c5f68-56a1-4c8e-9dfc-d391ceb62864", "userName":"John.Doe@mail.com" } ``` Note: You can call other APIs in the Sandbox environment just like you did with the 'Add User API'. The Sandbox offers functionality identical to the Production environment.