Add Gift Certificate to Checkout
POST /checkouts/{checkoutId}/gift-certificates
Request
Adds a Gift Certificate Code to Checkout.
Note
- Gift Certificates are treated as a payment methods.
- You are not able to purchase a gift certificate with a gift certificate.
- The rate limit is 20/hour (only for unique gift-certificate codes).
- Substitute your storefront domain for
yourstore.example.com
. - The Send a Test Request feature is not currently supported for this endpoint.
Parameters
- store_domain in path - string
- checkoutId in path - string - required
Body
giftCertificateCodestring
example
{ "giftCertificateCode": "string" }
Response
Body
idstring
cartobject
A cart contains a collection of items, prices, discounts, etc. It does not contain customer-related data.
billingAddressobject
consignmentsarray[object]
couponsarray[object]
Coupons applied at the checkout level.
orderIdstring
shippingCostTotalnumber
Shipping cost before any discounts are applied.
giftWrappingCostTotalnumber
Gift wrapping cost for all items, including or excluding tax.
handlingCostTotalnumber
Handling cost for all consignments including or excluding tax.
taxTotalnumber
taxesarray[object]
subtotalnumber
Subtotal of the checkout before applying item-level discounts. Tax inclusive based on the store settings.
grandTotalnumber
The total payable amount, before applying any store credit or gift certificate.
giftCertificatesarray[array]
Applied gift certificate (as a payment method).
createdTimestring
Time when the cart was created.
updatedTimestring
Time when the cart was last updated.
customerMessagestring
Shopperʼs message provided as details for the order to be created from this cart
outstandingBalancenumber
grandTotal
subtract the store-credit amountisStoreCreditAppliedboolean
true
value indicates StoreCredit has been applied.
example
{ "id": "29eb9b44-8f33-4e4a-9429-d0e8e24641ed", "cart": { "id": "29eb9b44-8f33-4e4a-9429-d0e8e24641ed", "customerId": 18, "email": "dwaynecole@testing.com", "currency": { "name": "US Dollars", "code": "USD", "symbol": "$", "decimalPlaces": 2 }, "isTaxIncluded": true, "baseAmount": 7.95, "discountAmount": 0, "cartAmount": 7.95, "coupons": [], "discounts": [ { "id": "243c9ca2-22b4-417a-8b09-b3fc05778b52", "discountedAmount": 0 } ], "lineItems": { "physicalItems": [ { "id": "243c9ca2-22b4-417a-8b09-b3fc05778b52", "parentId": {}, "variantId": 345, "productId": 174, "sku": "", "name": "1L Le Parfait Jar", "url": "https://{store_domain}/all/1l-le-parfait-jar/", "quantity": 1, "brand": "OFS", "isTaxable": true, "imageUrl": "https://cdn11.bigcommerce.com/s-{store_hash}/products/174/images/425/leparfaitmedium3_1024x1024_1024x1024__37756__81924.1534344526.330.500.jpg?c=2", "discounts": [], "discountAmount": 0, "couponAmount": 0, "originalPrice": 7.95, "listPrice": 7.95, "salePrice": 7.95, "extendedListPrice": 7.95, "extendedSalePrice": 7.95, "isShippingRequired": true, "giftWrapping": {}, "addedByPromotion": false } ], "digitalItems": [], "giftCertificates": [], "customItems": [] }, "createdTime": "2019-01-10T17:18:00+00:00", "updatedTime": "2019-01-10T17:19:47+00:00" }, "billingAddress": { "id": "5c377ead301c2", "firstName": "Dwayne", "lastName": "Cole", "email": "dwaynecole@testing.com", "company": "", "address1": "Mauna Kea Access Rd", "address2": "", "city": "Hilo", "stateOrProvince": "Hawaii", "stateOrProvinceCode": "HI", "country": "United States", "countryCode": "US", "postalCode": "96720", "phone": "8081234567", "customFields": [] }, "consignments": [ { "id": "5c377ead30ac1", "shippingCost": 8, "handlingCost": 0, "couponDiscounts": [], "discounts": [], "lineItemIds": [ "243c9ca2-22b4-417a-8b09-b3fc05778b52" ], "selectedShippingOption": { "id": "d09e05c0-3788-44df-a1bb-b6d3afdf6841", "type": "shipping_byweight", "description": "Ship by Weight", "imageUrl": "", "cost": 8, "transitTime": "" }, "address": { "firstName": "Dwayne", "lastName": "Cole", "email": "dwaynecole@testing.com", "company": "", "address1": "Mauna Kea Access Rd", "address2": "", "city": "Hilo", "stateOrProvince": "Hawaii", "stateOrProvinceCode": "HI", "country": "United States", "countryCode": "US", "postalCode": "96720", "phone": "8081234567", "customFields": [] } } ], "orderId": null, "shippingCostTotal": 8, "shippingCostBeforeDiscount": 8, "handlingCostTotal": 0, "taxTotal": 1.22, "coupons": [], "taxes": [ { "name": "Tax", "amount": 1.22 } ], "subtotal": 7.95, "grandTotal": 15.95, "giftCertificates": [], "createdTime": "2019-01-10T17:18:00+00:00", "updatedTime": "2019-01-10T17:19:47+00:00", "customerMessage": "" }
Delete Gift Certificate
DELETE /checkouts/{checkoutId}/gift-certificates/{giftCertificateCode}
Request
Deletes an existing Gift Certificate.
This removes the Gift Certificate payment method.
Note
- Substitute your storefront domain for
yourstore.example.com
. - The Send a Test Request feature is not currently supported for this endpoint.
Parameters
- store_domain in path - string
- checkoutId in path - string - required
- giftCertificateCode in path - string - required
example
const options = {method: 'DELETE', headers: {'Content-Type': 'application/json'}}; fetch('https://yourstore.example.com/api/storefront/checkouts/[checkoutId]/gift-certificates/[giftCertificateCode]', options) .then(response => response.json()) .then(response => console.log(response)) .catch(err => console.error(err));
Response
Body
idstring
cartobject
A cart contains a collection of items, prices, discounts, etc. It does not contain customer-related data.
billingAddressobject
consignmentsarray[object]
couponsarray[object]
Coupons applied at the checkout level.
orderIdstring
shippingCostTotalnumber
Shipping cost before any discounts are applied.
giftWrappingCostTotalnumber
Gift wrapping cost for all items, including or excluding tax.
handlingCostTotalnumber
Handling cost for all consignments including or excluding tax.
taxTotalnumber
taxesarray[object]
subtotalnumber
Subtotal of the checkout before applying item-level discounts. Tax inclusive based on the store settings.
grandTotalnumber
The total payable amount, before applying any store credit or gift certificate.
giftCertificatesarray[array]
Applied gift certificate (as a payment method).
createdTimestring
Time when the cart was created.
updatedTimestring
Time when the cart was last updated.
customerMessagestring
Shopperʼs message provided as details for the order to be created from this cart
outstandingBalancenumber
grandTotal
subtract the store-credit amountisStoreCreditAppliedboolean
true
value indicates StoreCredit has been applied.
example
{ "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "cart": { "id": "497f6eca-6276-4993-bfeb-53cbbbba6f08", "customer_id": 0, "email": "string", "currency": { "name": "string", "code": "string", "symbol": "string", "decimalPlaces": 0 }, "isTaxIncluded": true, "baseAmount": 0, "discountAmount": 0, "cartAmount": 0, "coupons": [ { "id": 0, "code": "string", "displayName": "string", "couponType": "per_item_discount", "discountedAmount": 0 } ], "discounts": [ { "name": "string", "discountedAmount": 0 } ], "lineItems": {}, "createdTime": "string", "updatedTime": "string" }, "billingAddress": { "firstName": "string", "lastName": "string", "email": "string", "company": "string", "address1": "string", "address2": "string", "city": "string", "stateOrProvince": "string", "stateOrProvinceCode": "string", "countryCode": "string", "postalCode": "string", "phone": "string", "customFields": [ { "fieldId": "string", "fieldValue": "string" } ] }, "consignments": [ { "id": "string", "shippingAddress": {}, "address": { "firstName": "string", "lastName": "string", "email": "string", "company": "string", "address1": "string", "address2": "string", "city": "string", "stateOrProvince": "string", "stateOrProvinceCode": "string", "countryCode": "string", "postalCode": "string", "phone": "string", "customFields": [ { "fieldId": "string", "fieldValue": "string" } ], "id": "string", "shouldSaveAddress": true }, "selectedPickupOption": { "pickupMethodId": 0 }, "availableShippingOptions": [ { "id": "string", "type": "string", "imageUrl": "string", "cost": 0, "transitTime": "string", "isRecommended": true, "additionalDescription": "string" } ], "selectedShippingOption": { "id": "string", "type": "string", "imageUrl": "string", "cost": 0, "transitTime": "string" }, "couponDiscounts": [ { "code": "string", "amount": 0 } ], "discounts": [ { "id": "string" } ], "shippingCost": 0, "handlingCost": 0, "lineItemIds": [ "string" ] } ], "coupons": [ { "id": 0, "code": "string", "displayName": "string", "couponType": 0, "discountedAmount": 0 } ], "orderId": "string", "shippingCostTotal": 0, "giftWrappingCostTotal": 0, "handlingCostTotal": 0, "taxTotal": 0, "taxes": [ { "name": "string", "amount": 0 } ], "subtotal": 0, "grandTotal": 0, "giftCertificates": [ [ { "balance": 0, "code": "string", "purchaseDate": "2019-08-24", "remaining": 0, "used": 0 } ] ], "createdTime": "string", "updatedTime": "string", "customerMessage": "string", "outstandingBalance": 0, "isStoreCreditApplied": true }