Skip to content

Instantly share code, notes, and snippets.

Avatar

SomewhereWarm SMPC somewherewarm-snippets

View GitHub Profile
View gc-rest-api-add-delete-gift-card-example2.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "EEEE-EEEE-EEEE-EEEE",
"amount": 40 // Gift card cannot be applied, process stops here
},
{
View gc-rest-api-delete-add-gift-card-example.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "KKKK-KKKK-KKKK-KKKK",
"amount": 0 // Deletes gift card, remaining order total becomes 70
},
{
View gc-rest-api-modify-gift-cards-in-order.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "KKKK-KKKK-KKKK-KKKK",
"amount":60
}
]
View gc-rest-api-apply-multiple-gift-cards-example.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "ΧΧΧΧ-ΧΧΧΧ-ΧΧΧΧ-ΧΧΧΧ",
"amount":30 // Remaining order total becomes $70
},
{
View gc-rest-api-apply-multiple-gift-cards-order-total-exceeded-example.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"id": 43,
"code": "XXXX-XXXX-XXXX-XXXX",
"amount": 50 // Remaining order total becomes $50
},
View gc-rest-api-apply-gift-card-with-unspecified-amount-to-order.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "KKKK-KKKK-KKKK-KKKK"
}
]
}'
View gc-rest-api-delete-gift-card-from-order.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "XXXX-XXXX-XXXX-XXXX",
"amount": 0
}
]
View gc-rest-api-apply-gift-card-with-specified-amount-to-order.txt
curl -X PUT https://somewherewarm.test/support/wp-json/wc/v3/orders/68 \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"gift_cards": [
{
"code": "XXXX-XXXX-XXXX-XXXX",
"amount": 30
}
]
View gc-rest-api-create-order-with-gift-card.txt
curl -X POST https://example.com/wp-json/wc/v3/orders \
-u consumer_key:consumer_secret \
-H "Content-Type: application/json" \
-d '{
"payment_method": "bacs",
"payment_method_title": "Direct Bank Transfer",
"set_paid": false,
"billing": {
"first_name": "John",
"last_name": "Doe",
View gc-rest-api-retrieve-specific-gift-card-order-json-response.txt
{
"id": 288,
"parent_id": 0,
"status": "processing",
"currency": "EUR",
"version": "5.1.0",
"prices_include_tax": false,
"date_created": "2021-04-07T10:28:16",
"date_modified": "2021-04-07T10:28:17",
"discount_total": "0.00",