Creates a Store Credit
curl --request POST \
--url http://{defaultHost}/api/v2/platform/store_credits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"store_credit": {
"user_id": "2",
"category_id": "4",
"created_by_id": "5",
"amount": 25,
"amount_used": 10,
"memo": "This credit was given as a refund",
"currency": "USD",
"amount_authorized": 15.5,
"originator_id": "3",
"originator_type": "Refund",
"type_id": "1",
"store_id": "2",
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "6",
"type": "store_credit",
"attributes": {
"amount": "150.0",
"amount_used": "0.0",
"memo": null,
"deleted_at": null,
"currency": "USD",
"amount_authorized": "0.0",
"originator_type": null,
"created_at": "2022-11-08T19:35:39.272Z",
"updated_at": "2022-11-08T19:35:39.272Z",
"public_metadata": {},
"private_metadata": {},
"display_amount": "$150.00",
"display_amount_used": "$0.00"
},
"relationships": {
"user": {
"data": {
"id": "113",
"type": "user"
}
},
"created_by": {
"data": {
"id": "114",
"type": "user"
}
},
"store_credit_category": {
"data": {
"id": "18",
"type": "store_credit_category"
}
},
"store_credit_type": {
"data": {
"id": "18",
"type": "store_credit_type"
}
},
"store_credit_events": {
"data": [
{
"id": "7",
"type": "store_credit_event"
}
]
}
}
}
}
Bearer authentication header of the form Bearer <token>
, where <token>
is your auth token.
Select which associated resources you would like to fetch, see: <a href="https://jsonapi.org/format/#fetching-includes">https://jsonapi.org/format/#fetching-includes</a>
Record created
The response is of type object
.
Was this page helpful?
curl --request POST \
--url http://{defaultHost}/api/v2/platform/store_credits \
--header 'Authorization: Bearer <token>' \
--header 'Content-Type: application/json' \
--data '{
"store_credit": {
"user_id": "2",
"category_id": "4",
"created_by_id": "5",
"amount": 25,
"amount_used": 10,
"memo": "This credit was given as a refund",
"currency": "USD",
"amount_authorized": 15.5,
"originator_id": "3",
"originator_type": "Refund",
"type_id": "1",
"store_id": "2",
"public_metadata": {},
"private_metadata": {}
}
}'
{
"data": {
"id": "6",
"type": "store_credit",
"attributes": {
"amount": "150.0",
"amount_used": "0.0",
"memo": null,
"deleted_at": null,
"currency": "USD",
"amount_authorized": "0.0",
"originator_type": null,
"created_at": "2022-11-08T19:35:39.272Z",
"updated_at": "2022-11-08T19:35:39.272Z",
"public_metadata": {},
"private_metadata": {},
"display_amount": "$150.00",
"display_amount_used": "$0.00"
},
"relationships": {
"user": {
"data": {
"id": "113",
"type": "user"
}
},
"created_by": {
"data": {
"id": "114",
"type": "user"
}
},
"store_credit_category": {
"data": {
"id": "18",
"type": "store_credit_category"
}
},
"store_credit_type": {
"data": {
"id": "18",
"type": "store_credit_type"
}
},
"store_credit_events": {
"data": [
{
"id": "7",
"type": "store_credit_event"
}
]
}
}
}
}