POST
https://api.cryptohopper.com/v1/market/giftcards/user
Creates a custom gift card design under your account. A credits gift card has a value between 5 and 2000 USD; values outside that range are set to the nearest limit.
OAuth scope:
read manage About scopes
Body fields: name (required, checked by a profanity filter), giftcard_type (credits or subscription, default credits), giftcard_value (required for credits), giftcard_image (required, one of the URLs from GET /market/giftcards/images) and payment_term (subscription only: 1year, 3months or 6months, anything else is one month). In the current code the chosen image is not stored, and subscription gift cards get no price because no plan is set.
Example request
curl -X POST "https://api.cryptohopper.com/v1/market/giftcards/user" \
-H "access-token: YOUR_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{"name":"Birthday gift","giftcard_type":"credits","giftcard_value":50,"giftcard_image":"https://cdn.cryptohopper.com/images/giftcards/templates/birthday.png"}'
const response = await fetch('https://api.cryptohopper.com/v1/market/giftcards/user', {
method: 'POST',
headers: {
"access-token": "YOUR_ACCESS_TOKEN",
"Content-Type": "application/json"
},
body: JSON.stringify({
"name": "Birthday gift",
"giftcard_type": "credits",
"giftcard_value": 50,
"giftcard_image": "https://cdn.cryptohopper.com/images/giftcards/templates/birthday.png"
})
});
const data = await response.json();
import requests
response = requests.post(
"https://api.cryptohopper.com/v1/market/giftcards/user",
headers={
"access-token": "YOUR_ACCESS_TOKEN"
},
json={
"name": "Birthday gift",
"giftcard_type": "credits",
"giftcard_value": 50,
"giftcard_image": "https://cdn.cryptohopper.com/images/giftcards/templates/birthday.png"
},
)
data = response.json()
$ch = curl_init('https://api.cryptohopper.com/v1/market/giftcards/user');
curl_setopt_array($ch, [
CURLOPT_CUSTOMREQUEST => 'POST',
CURLOPT_RETURNTRANSFER => true,
CURLOPT_HTTPHEADER => [
'access-token: YOUR_ACCESS_TOKEN',
'Content-Type: application/json',
],
CURLOPT_POSTFIELDS => json_encode([
'name' => 'Birthday gift',
'giftcard_type' => 'credits',
'giftcard_value' => 50,
'giftcard_image' => 'https://cdn.cryptohopper.com/images/giftcards/templates/birthday.png',
]),
]);
$data = json_decode(curl_exec($ch), true);
Parameters
Headers
| Name | Type | Required | Description |
|---|---|---|---|
access-token |
string | Required | The OAuth access token of the user. |
Response
{
"data": {
"giftcard_id": 57,
"message": "Your new giftcard has been saved."
}
}