{"templateId":"markdown","sharedDataIds":{"sidebar":"sidebar-sidebars.yaml","api-docs-apis/onward.yaml":"api-docs-apis/onward.yaml","api-docs-apis/callbacks.yaml":"api-docs-apis/callbacks.yaml"},"props":{"metadata":{"markdoc":{"tagList":["img","admonition","openapi-code-sample","openapi-response-sample"]},"type":"markdown"},"seo":{"title":"Working with Cashback","description":"We’re on a mission to help brands exceed customer expectations and grow profitably. We’re excited to work with you. Let’s do this!"},"dynamicMarkdocComponents":["openapi"],"compilationErrors":[],"ast":{"$$mdtype":"Tag","name":"article","attributes":{},"children":[{"$$mdtype":"Tag","name":"Heading","attributes":{"level":1,"id":"working-with-cashback","__idx":0},"children":["Working with Cashback"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Onward maintains a cashback balance for each customer, along with the ledger entries behind it. How the customer spends that balance depends on where the shop sells."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["If your platform also awards credit, you can add or reverse it through the Rewards API. You never post redemptions."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your platform holds the spendable balance. When a customer earns cashback, Onward records it in the ledger and calls your \"Issue a reward\" callback API so you can issue the same amount on your side. When the customer spends the balance, you tell Onward through the Orders API so the ledger can record the redemption."]},{"$$mdtype":"Tag","name":"Image","attributes":{"src":"/assets/cashback-issuance-usage.e24c49f011f904e3e6353d279d987c511b21b9b71b38c141d1a51cb742a954aa.9bb1daa4.png","alt":"Cashback Issuance Flow","framed":false,"withLightbox":true,"width":"","height":""},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"before-you-start","__idx":1},"children":["Before you start"]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Register your callback base URL with Onward as described in ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/guides/registering_callbacks"},"children":["Registering Callback Endpoint"]},". Without it, Onward still records the credit in the ledger but has nowhere to send it"]},{"$$mdtype":"Tag","name":"li","attributes":{},"children":["Send every order, not only protected ones. Customers can spend rewards on an unprotected order, so Onward needs to see those orders to keep its balance in step with yours"]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-does-a-customer-earn-cashback","__idx":2},"children":["How does a customer earn cashback?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When you send orders through the Orders API, Onward calculates the cashback each order earns and adds it to the customer's ledger. As the customer's balance changes on the ledger, we call your system at your registered callback URL to issue or update the balance of your e-commerce platform's preferred redemption method (discount code, store credit, etc). When the customer spends some of it, you include that amount on the order you send to Onward. That way both balances stay in sync."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Only protected orders earn cashback, but customers can spend their balance on any order. That's why Onward needs to see every order you process, not just the protected ones."]},{"$$mdtype":"Tag","name":"Admonition","attributes":{"type":"info"},"children":[{"$$mdtype":"Tag","name":"p","attributes":{},"children":["You can stop specific sales channels from earning cashback. Send ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["source_name"]}," on each order (for example ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["web"]},", ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["phone"]},", or a marketplace name), then your Onward account representative can configure Cashback eligibility exceptions for you."]}]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"1-customer-places-a-regular-order","__idx":3},"children":["1. Customer places a regular order"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Create each order with ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /orders"]}," when the customer places it. Onward works out the credit from the line item totals after discounts. The response returns the customer object along with their updated reward balance, so you don't need a separate request to check it."]},{"$$mdtype":"Tag","name":"OpenApiCodeSample","attributes":{"descriptionFile":"api-docs-apis/onward.yaml","operationId":"createOrder","parameters":{},"environments":{},"codeSamplesResolved":[{"lang":"shell","title":"curl","source":"curl -i -X POST \\\n  https://app.useonward.com/api/v1/orders \\\n  -H 'Accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-API-Key: YOUR_API_KEY_HERE' \\\n  -d '{\n    \"shop_order_id\": \"18282\",\n    \"shop_order_number\": \"W-94713\",\n    \"subtotal_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"subtotal_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_discounts_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_discounts_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_shipping_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_shipping_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_tax_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_tax_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"amount_protected\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"amount_protected_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"purchased_quote_token\": \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n    \"created_at\": \"2024-11-26T17:32:28Z\",\n    \"financial_status\": \"paid\",\n    \"source_name\": \"phone\",\n    \"customer\": {\n      \"shop_customer_id\": \"6072418623\",\n      \"first_name\": \"Sally\",\n      \"last_name\": \"Loo\",\n      \"email\": \"sally@example.com\",\n      \"phone_number\": \"+13105551234\"\n    },\n    \"shipping_address\": {\n      \"address1\": \"123 Main St\",\n      \"address2\": \"Unit 50\",\n      \"province_code\": \"CA\",\n      \"city\": \"Los Angeles\",\n      \"postal_code\": \"90210\",\n      \"country_code\": \"US\",\n      \"phone_number\": \"+13105551234\"\n    },\n    \"line_items\": [\n      {\n        \"shop_line_item_id\": \"816721\",\n        \"shop_product_id\": \"142\",\n        \"shop_variant_id\": \"7261\",\n        \"name\": \"Cool T-shirt - Red\",\n        \"unit_price\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"total_price\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"total_price_presentment\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"quantity\": 2,\n        \"image_url\": \"https://placecats.com/neo/300/200.png\",\n        \"grams\": 24,\n        \"is_protected\": true,\n        \"requires_shipping\": true,\n        \"refunded_quantity\": 1,\n        \"refunded_price\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"refunded_price_presentment\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        }\n      }\n    ]\n  }'"},{"lang":"javascript","title":"JavaScript","source":"const resp = await fetch(\n  `https://app.useonward.com/api/v1/orders`,\n  {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json',\n      Accept: 'application/json',\n      'X-API-Key': 'YOUR_API_KEY_HERE'\n    },\n    body: JSON.stringify({\n      shop_order_id: '18282',\n      shop_order_number: 'W-94713',\n      subtotal_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      subtotal_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_discounts_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_discounts_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_shipping_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_shipping_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_tax_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_tax_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      amount_protected: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      amount_protected_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      purchased_quote_token: 'c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==',\n      created_at: '2024-11-26T17:32:28Z',\n      financial_status: 'paid',\n      source_name: 'phone',\n      customer: {\n        shop_customer_id: '6072418623',\n        first_name: 'Sally',\n        last_name: 'Loo',\n        email: 'sally@example.com',\n        phone_number: '+13105551234'\n      },\n      shipping_address: {\n        address1: '123 Main St',\n        address2: 'Unit 50',\n        province_code: 'CA',\n        city: 'Los Angeles',\n        postal_code: '90210',\n        country_code: 'US',\n        phone_number: '+13105551234'\n      },\n      line_items: [\n        {\n          shop_line_item_id: '816721',\n          shop_product_id: '142',\n          shop_variant_id: '7261',\n          name: 'Cool T-shirt - Red',\n          unit_price: {\n            cents: 1299,\n            currency: 'USD'\n          },\n          total_price: {\n            cents: 1299,\n            currency: 'USD'\n          },\n          total_price_presentment: {\n            cents: 1299,\n            currency: 'USD'\n          },\n          quantity: 2,\n          image_url: 'https://placecats.com/neo/300/200.png',\n          grams: 24,\n          is_protected: true,\n          requires_shipping: true,\n          refunded_quantity: 1,\n          refunded_price: {\n            cents: 1299,\n            currency: 'USD'\n          },\n          refunded_price_presentment: {\n            cents: 1299,\n            currency: 'USD'\n          }\n        }\n      ]\n    })\n  }\n);\n\nconst data = await resp.json();\nconsole.log(data);"},{"lang":"javascript","title":"Node.js","source":"import fetch from 'node-fetch';\n\nasync function run() {\n  const resp = await fetch(\n    `https://app.useonward.com/api/v1/orders`,\n    {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n        Accept: 'application/json',\n        'X-API-Key': 'YOUR_API_KEY_HERE'\n      },\n      body: JSON.stringify({\n        shop_order_id: '18282',\n        shop_order_number: 'W-94713',\n        subtotal_price: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        subtotal_price_presentment: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_discounts_price: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_discounts_price_presentment: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_shipping_price: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_shipping_price_presentment: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_tax_price: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_tax_price_presentment: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_price: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        total_price_presentment: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        amount_protected: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        amount_protected_presentment: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        purchased_quote_token: 'c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==',\n        created_at: '2024-11-26T17:32:28Z',\n        financial_status: 'paid',\n        source_name: 'phone',\n        customer: {\n          shop_customer_id: '6072418623',\n          first_name: 'Sally',\n          last_name: 'Loo',\n          email: 'sally@example.com',\n          phone_number: '+13105551234'\n        },\n        shipping_address: {\n          address1: '123 Main St',\n          address2: 'Unit 50',\n          province_code: 'CA',\n          city: 'Los Angeles',\n          postal_code: '90210',\n          country_code: 'US',\n          phone_number: '+13105551234'\n        },\n        line_items: [\n          {\n            shop_line_item_id: '816721',\n            shop_product_id: '142',\n            shop_variant_id: '7261',\n            name: 'Cool T-shirt - Red',\n            unit_price: {\n              cents: 1299,\n              currency: 'USD'\n            },\n            total_price: {\n              cents: 1299,\n              currency: 'USD'\n            },\n            total_price_presentment: {\n              cents: 1299,\n              currency: 'USD'\n            },\n            quantity: 2,\n            image_url: 'https://placecats.com/neo/300/200.png',\n            grams: 24,\n            is_protected: true,\n            requires_shipping: true,\n            refunded_quantity: 1,\n            refunded_price: {\n              cents: 1299,\n              currency: 'USD'\n            },\n            refunded_price_presentment: {\n              cents: 1299,\n              currency: 'USD'\n            }\n          }\n        ]\n      })\n    }\n  );\n\n  const data = await resp.json();\n  console.log(data);\n}\n\nrun();"},{"lang":"python","title":"Python","source":"import requests\n\nurl = \"https://app.useonward.com/api/v1/orders\"\n\npayload = {\n  \"shop_order_id\": \"18282\",\n  \"shop_order_number\": \"W-94713\",\n  \"subtotal_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"subtotal_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_discounts_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_discounts_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_shipping_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_shipping_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_tax_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_tax_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"amount_protected\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"amount_protected_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"purchased_quote_token\": \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n  \"created_at\": \"2024-11-26T17:32:28Z\",\n  \"financial_status\": \"paid\",\n  \"source_name\": \"phone\",\n  \"customer\": {\n    \"shop_customer_id\": \"6072418623\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"shipping_address\": {\n    \"address1\": \"123 Main St\",\n    \"address2\": \"Unit 50\",\n    \"province_code\": \"CA\",\n    \"city\": \"Los Angeles\",\n    \"postal_code\": \"90210\",\n    \"country_code\": \"US\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"line_items\": [\n    {\n      \"shop_line_item_id\": \"816721\",\n      \"shop_product_id\": \"142\",\n      \"shop_variant_id\": \"7261\",\n      \"name\": \"Cool T-shirt - Red\",\n      \"unit_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"total_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"total_price_presentment\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"quantity\": 2,\n      \"image_url\": \"https://placecats.com/neo/300/200.png\",\n      \"grams\": 24,\n      \"is_protected\": True,\n      \"requires_shipping\": True,\n      \"refunded_quantity\": 1,\n      \"refunded_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"refunded_price_presentment\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      }\n    }\n  ]\n}\n\nheaders = {\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\",\n  \"X-API-Key\": \"YOUR_API_KEY_HERE\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\ndata = response.json()\nprint(data)"},{"lang":"java","title":"Java","source":"import java.net.*;\nimport java.net.http.*;\nimport java.util.*;\n\npublic class App {\n  public static void main(String[] args) throws Exception {\n    var httpClient = HttpClient.newBuilder().build();\n\n    var payload = String.join(\"\\n\"\n      , \"{\"\n      , \" \\\"shop_order_id\\\": \\\"18282\\\",\"\n      , \" \\\"shop_order_number\\\": \\\"W-94713\\\",\"\n      , \" \\\"subtotal_price\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"subtotal_price_presentment\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_discounts_price\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_discounts_price_presentment\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_shipping_price\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_shipping_price_presentment\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_tax_price\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_tax_price_presentment\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_price\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"total_price_presentment\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"amount_protected\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"amount_protected_presentment\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"purchased_quote_token\\\": \\\"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\\\",\"\n      , \" \\\"created_at\\\": \\\"2024-11-26T17:32:28Z\\\",\"\n      , \" \\\"financial_status\\\": \\\"paid\\\",\"\n      , \" \\\"source_name\\\": \\\"phone\\\",\"\n      , \" \\\"customer\\\": {\"\n      , \"  \\\"shop_customer_id\\\": \\\"6072418623\\\",\"\n      , \"  \\\"first_name\\\": \\\"Sally\\\",\"\n      , \"  \\\"last_name\\\": \\\"Loo\\\",\"\n      , \"  \\\"email\\\": \\\"sally@example.com\\\",\"\n      , \"  \\\"phone_number\\\": \\\"+13105551234\\\"\"\n      , \" },\"\n      , \" \\\"shipping_address\\\": {\"\n      , \"  \\\"address1\\\": \\\"123 Main St\\\",\"\n      , \"  \\\"address2\\\": \\\"Unit 50\\\",\"\n      , \"  \\\"province_code\\\": \\\"CA\\\",\"\n      , \"  \\\"city\\\": \\\"Los Angeles\\\",\"\n      , \"  \\\"postal_code\\\": \\\"90210\\\",\"\n      , \"  \\\"country_code\\\": \\\"US\\\",\"\n      , \"  \\\"phone_number\\\": \\\"+13105551234\\\"\"\n      , \" },\"\n      , \" \\\"line_items\\\": [\"\n      , \"  {\"\n      , \"   \\\"shop_line_item_id\\\": \\\"816721\\\",\"\n      , \"   \\\"shop_product_id\\\": \\\"142\\\",\"\n      , \"   \\\"shop_variant_id\\\": \\\"7261\\\",\"\n      , \"   \\\"name\\\": \\\"Cool T-shirt - Red\\\",\"\n      , \"   \\\"unit_price\\\": {\"\n      , \"    \\\"cents\\\": 1299,\"\n      , \"    \\\"currency\\\": \\\"USD\\\"\"\n      , \"   },\"\n      , \"   \\\"total_price\\\": {\"\n      , \"    \\\"cents\\\": 1299,\"\n      , \"    \\\"currency\\\": \\\"USD\\\"\"\n      , \"   },\"\n      , \"   \\\"total_price_presentment\\\": {\"\n      , \"    \\\"cents\\\": 1299,\"\n      , \"    \\\"currency\\\": \\\"USD\\\"\"\n      , \"   },\"\n      , \"   \\\"quantity\\\": 2,\"\n      , \"   \\\"image_url\\\": \\\"https://placecats.com/neo/300/200.png\\\",\"\n      , \"   \\\"grams\\\": 24,\"\n      , \"   \\\"is_protected\\\": true,\"\n      , \"   \\\"requires_shipping\\\": true,\"\n      , \"   \\\"refunded_quantity\\\": 1,\"\n      , \"   \\\"refunded_price\\\": {\"\n      , \"    \\\"cents\\\": 1299,\"\n      , \"    \\\"currency\\\": \\\"USD\\\"\"\n      , \"   },\"\n      , \"   \\\"refunded_price_presentment\\\": {\"\n      , \"    \\\"cents\\\": 1299,\"\n      , \"    \\\"currency\\\": \\\"USD\\\"\"\n      , \"   }\"\n      , \"  }\"\n      , \" ]\"\n      , \"}\"\n    );\n\n    var host = \"https://app.useonward.com\";\n    var pathname = \"/api/v1/orders\";\n    var request = HttpRequest.newBuilder()\n      .POST(HttpRequest.BodyPublishers.ofString(payload))\n      .uri(URI.create(host + pathname ))\n      .header(\"Content-Type\", \"application/json\")\n      .header(\"Accept\", \"application/json\")\n      .header(\"X-API-Key\", \"YOUR_API_KEY_HERE\")\n      .build();\n\n    var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());\n\n    System.out.println(response.body());\n  }\n}"},{"lang":"csharp","title":"C#","source":"using System;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing System.Text;\nusing System.Text.Json;\n\npublic class Program\n{\n  public static async Task Main()\n  {\n    System.Net.Http.HttpClient client = new()\n    {\n      DefaultRequestHeaders =\n      {\n        {\"Accept\", \"application/json\"},\n        {\"X-API-Key\", \"YOUR_API_KEY_HERE\"},\n      }\n    };\n\n    string json = JsonSerializer.Serialize(new\n    {\n      shop_order_id = \"18282\",\n      shop_order_number = \"W-94713\",\n      subtotal_price = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      subtotal_price_presentment = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_discounts_price = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_discounts_price_presentment = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_shipping_price = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_shipping_price_presentment = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_tax_price = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_tax_price_presentment = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_price = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      total_price_presentment = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      amount_protected = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      amount_protected_presentment = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      purchased_quote_token = \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n      created_at = \"2024-11-26T17:32:28Z\",\n      financial_status = \"paid\",\n      source_name = \"phone\",\n      customer = new {\n        shop_customer_id = \"6072418623\",\n        first_name = \"Sally\",\n        last_name = \"Loo\",\n        email = \"sally@example.com\",\n        phone_number = \"+13105551234\"\n      },\n      shipping_address = new {\n        address1 = \"123 Main St\",\n        address2 = \"Unit 50\",\n        province_code = \"CA\",\n        city = \"Los Angeles\",\n        postal_code = \"90210\",\n        country_code = \"US\",\n        phone_number = \"+13105551234\"\n      },\n      line_items = new[] {\n        new {\n          shop_line_item_id = \"816721\",\n          shop_product_id = \"142\",\n          shop_variant_id = \"7261\",\n          name = \"Cool T-shirt - Red\",\n          unit_price = new {\n            cents = \"1299\",\n            currency = \"USD\"\n          },\n          total_price = new {\n            cents = \"1299\",\n            currency = \"USD\"\n          },\n          total_price_presentment = new {\n            cents = \"1299\",\n            currency = \"USD\"\n          },\n          quantity = \"2\",\n          image_url = \"https://placecats.com/neo/300/200.png\",\n          grams = \"24\",\n          is_protected = \"true\",\n          requires_shipping = \"true\",\n          refunded_quantity = \"1\",\n          refunded_price = new {\n            cents = \"1299\",\n            currency = \"USD\"\n          },\n          refunded_price_presentment = new {\n            cents = \"1299\",\n            currency = \"USD\"\n          }\n        }\n      },\n    });\n\n    using StringContent postData = new(json, Encoding.UTF8, \"application/json\");\n    using HttpResponseMessage request = await client.PostAsync(\"https://app.useonward.com/api/v1/orders\", postData);\n    string response = await request.Content.ReadAsStringAsync();\n\n    Console.WriteLine(response);\n  }\n}"},{"lang":"php","title":"PHP","source":"/**\n * Requires libcurl\n */\n\n$curl = curl_init();\n\n$payload = array(\n  \"shop_order_id\" => \"18282\",\n  \"shop_order_number\" => \"W-94713\",\n  \"subtotal_price\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"subtotal_price_presentment\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_discounts_price\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_discounts_price_presentment\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_shipping_price\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_shipping_price_presentment\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_tax_price\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_tax_price_presentment\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_price\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"total_price_presentment\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"amount_protected\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"amount_protected_presentment\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"purchased_quote_token\" => \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b\\$\\$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n  \"created_at\" => \"2024-11-26T17:32:28Z\",\n  \"financial_status\" => \"paid\",\n  \"source_name\" => \"phone\",\n  \"customer\" => array(\n    \"shop_customer_id\" => \"6072418623\",\n    \"first_name\" => \"Sally\",\n    \"last_name\" => \"Loo\",\n    \"email\" => \"sally@example.com\",\n    \"phone_number\" => \"+13105551234\"\n  ),\n  \"shipping_address\" => array(\n    \"address1\" => \"123 Main St\",\n    \"address2\" => \"Unit 50\",\n    \"province_code\" => \"CA\",\n    \"city\" => \"Los Angeles\",\n    \"postal_code\" => \"90210\",\n    \"country_code\" => \"US\",\n    \"phone_number\" => \"+13105551234\"\n  ),\n  \"line_items\" => array(\n    array(\n      \"shop_line_item_id\" => \"816721\",\n      \"shop_product_id\" => \"142\",\n      \"shop_variant_id\" => \"7261\",\n      \"name\" => \"Cool T-shirt - Red\",\n      \"unit_price\" => array(\n        \"cents\" => 1299,\n        \"currency\" => \"USD\"\n      ),\n      \"total_price\" => array(\n        \"cents\" => 1299,\n        \"currency\" => \"USD\"\n      ),\n      \"total_price_presentment\" => array(\n        \"cents\" => 1299,\n        \"currency\" => \"USD\"\n      ),\n      \"quantity\" => 2,\n      \"image_url\" => \"https://placecats.com/neo/300/200.png\",\n      \"grams\" => 24,\n      \"is_protected\" => true,\n      \"requires_shipping\" => true,\n      \"refunded_quantity\" => 1,\n      \"refunded_price\" => array(\n        \"cents\" => 1299,\n        \"currency\" => \"USD\"\n      ),\n      \"refunded_price_presentment\" => array(\n        \"cents\" => 1299,\n        \"currency\" => \"USD\"\n      )\n    )\n  )\n);\n\ncurl_setopt_array($curl, [\n  CURLOPT_HTTPHEADER => [\n    \"Accept: application/json\",\n    \"Content-Type: application/json\",\n    \"X-API-Key: YOUR_API_KEY_HERE\"\n  ],\n  CURLOPT_POSTFIELDS => json_encode($payload),\n  CURLOPT_URL => \"https://app.useonward.com/api/v1/orders\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n]);\n\n$response = curl_exec($curl);\n$error = curl_error($curl);\n\ncurl_close($curl);\n\nif ($error) {\n  echo \"cURL Error #:\" . $error;\n} else {\n  echo $response;\n}"},{"lang":"go","title":"Go","source":"package main\n\nimport (\n  \"fmt\"\n  \"bytes\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n  reqUrl := \"https://app.useonward.com/api/v1/orders\"\n  var data = []byte(`{\n    \"shop_order_id\": \"18282\",\n    \"shop_order_number\": \"W-94713\",\n    \"subtotal_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"subtotal_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_discounts_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_discounts_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_shipping_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_shipping_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_tax_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_tax_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"total_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"amount_protected\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"amount_protected_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"purchased_quote_token\": \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n    \"created_at\": \"2024-11-26T17:32:28Z\",\n    \"financial_status\": \"paid\",\n    \"source_name\": \"phone\",\n    \"customer\": {\n      \"shop_customer_id\": \"6072418623\",\n      \"first_name\": \"Sally\",\n      \"last_name\": \"Loo\",\n      \"email\": \"sally@example.com\",\n      \"phone_number\": \"+13105551234\"\n    },\n    \"shipping_address\": {\n      \"address1\": \"123 Main St\",\n      \"address2\": \"Unit 50\",\n      \"province_code\": \"CA\",\n      \"city\": \"Los Angeles\",\n      \"postal_code\": \"90210\",\n      \"country_code\": \"US\",\n      \"phone_number\": \"+13105551234\"\n    },\n    \"line_items\": [\n      {\n        \"shop_line_item_id\": \"816721\",\n        \"shop_product_id\": \"142\",\n        \"shop_variant_id\": \"7261\",\n        \"name\": \"Cool T-shirt - Red\",\n        \"unit_price\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"total_price\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"total_price_presentment\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"quantity\": 2,\n        \"image_url\": \"https://placecats.com/neo/300/200.png\",\n        \"grams\": 24,\n        \"is_protected\": true,\n        \"requires_shipping\": true,\n        \"refunded_quantity\": 1,\n        \"refunded_price\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"refunded_price_presentment\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        }\n      }\n    ]\n  }`)\n  req, err := http.NewRequest(\"POST\", reqUrl, bytes.NewBuffer(data))\n  if err != nil {\n    panic(err)\n  }\n  req.Header.Add(\"Content-Type\", \"application/json\")\n  req.Header.Add(\"Accept\", \"application/json\")\n  req.Header.Add(\"X-API-Key\", \"YOUR_API_KEY_HERE\")\n  res, err := http.DefaultClient.Do(req)\n  if err != nil {\n    panic(err)\n  }\n  defer res.Body.Close()\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    panic(err)\n  }\n\n  fmt.Println(res)\n  fmt.Println(string(body))\n}"},{"lang":"ruby","title":"Ruby","source":"require 'json'\nrequire 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nurl = URI('https://app.useonward.com/api/v1/orders')\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest['Content-Type'] = 'application/json'\nrequest['Accept'] = 'application/json'\nrequest['X-API-Key'] = 'YOUR_API_KEY_HERE'\nrequest.body = {\n  shop_order_id: '18282',\n  shop_order_number: 'W-94713',\n  subtotal_price: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  subtotal_price_presentment: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_discounts_price: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_discounts_price_presentment: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_shipping_price: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_shipping_price_presentment: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_tax_price: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_tax_price_presentment: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_price: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  total_price_presentment: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  amount_protected: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  amount_protected_presentment: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  purchased_quote_token: 'c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==',\n  created_at: '2024-11-26T17:32:28Z',\n  financial_status: 'paid',\n  source_name: 'phone',\n  customer: {\n    shop_customer_id: '6072418623',\n    first_name: 'Sally',\n    last_name: 'Loo',\n    email: 'sally@example.com',\n    phone_number: '+13105551234'\n  },\n  shipping_address: {\n    address1: '123 Main St',\n    address2: 'Unit 50',\n    province_code: 'CA',\n    city: 'Los Angeles',\n    postal_code: '90210',\n    country_code: 'US',\n    phone_number: '+13105551234'\n  },\n  line_items: [\n    {\n      shop_line_item_id: '816721',\n      shop_product_id: '142',\n      shop_variant_id: '7261',\n      name: 'Cool T-shirt - Red',\n      unit_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      total_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      quantity: 2,\n      image_url: 'https://placecats.com/neo/300/200.png',\n      grams: 24,\n      is_protected: true,\n      requires_shipping: true,\n      refunded_quantity: 1,\n      refunded_price: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      refunded_price_presentment: {\n        cents: 1299,\n        currency: 'USD'\n      }\n    }\n  ]\n}.to_json\n\nresponse = http.request(request)\nputs response.read_body\n"},{"lang":"r","title":"R","source":"library(httr)\n\nbody = '{\n   \"shop_order_id\": \"18282\",\n   \"shop_order_number\": \"W-94713\",\n   \"subtotal_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"subtotal_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_discounts_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_discounts_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_shipping_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_shipping_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_tax_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_tax_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"total_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"amount_protected\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"amount_protected_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"purchased_quote_token\": \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n   \"created_at\": \"2024-11-26T17:32:28Z\",\n   \"financial_status\": \"paid\",\n   \"source_name\": \"phone\",\n   \"customer\": {\n    \"shop_customer_id\": \"6072418623\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\"\n   },\n   \"shipping_address\": {\n    \"address1\": \"123 Main St\",\n    \"address2\": \"Unit 50\",\n    \"province_code\": \"CA\",\n    \"city\": \"Los Angeles\",\n    \"postal_code\": \"90210\",\n    \"country_code\": \"US\",\n    \"phone_number\": \"+13105551234\"\n   },\n   \"line_items\": [\n    {\n     \"shop_line_item_id\": \"816721\",\n     \"shop_product_id\": \"142\",\n     \"shop_variant_id\": \"7261\",\n     \"name\": \"Cool T-shirt - Red\",\n     \"unit_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n     },\n     \"total_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n     },\n     \"total_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n     },\n     \"quantity\": 2,\n     \"image_url\": \"https://placecats.com/neo/300/200.png\",\n     \"grams\": 24,\n     \"is_protected\": true,\n     \"requires_shipping\": true,\n     \"refunded_quantity\": 1,\n     \"refunded_price\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n     },\n     \"refunded_price_presentment\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n     }\n    }\n   ]\n}'\n\nurl = \"https://app.useonward.com/api/v1/orders\"\n\ndata_req <- POST(\n  url,\n  add_headers(\"Content-Type\" = \"application/json\", \"Accept\" = \"application/json\", \"X-API-Key\" = \"YOUR_API_KEY_HERE\"),\n  body = body,\n  encode = \"json\",\n  verbose()\n)\n\ncontent(data_req)"},{"lang":"json","title":"Payload application/json","source":"{\n  \"shop_order_id\": \"18282\",\n  \"shop_order_number\": \"W-94713\",\n  \"subtotal_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"subtotal_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_discounts_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_discounts_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_shipping_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_shipping_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_tax_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_tax_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"amount_protected\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"amount_protected_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"purchased_quote_token\": \"c0740f7e3d4718a64fd9ce18101961d210d1c61c8c8afd62f95d62d8c433347b$$qkJClv/+sWfpOfPqp4sI46PxzBuBCW4eEDKsL4q87aFhRT9mdCpIuEWwuRuvbkX4BS8=--AUnUz8WgunyUiZ4o--nnYz0Lj5WsxSqsUxtBpIIQ==\",\n  \"created_at\": \"2024-11-26T17:32:28Z\",\n  \"financial_status\": \"paid\",\n  \"source_name\": \"phone\",\n  \"customer\": {\n    \"shop_customer_id\": \"6072418623\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"shipping_address\": {\n    \"address1\": \"123 Main St\",\n    \"address2\": \"Unit 50\",\n    \"province_code\": \"CA\",\n    \"city\": \"Los Angeles\",\n    \"postal_code\": \"90210\",\n    \"country_code\": \"US\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"line_items\": [\n    {\n      \"shop_line_item_id\": \"816721\",\n      \"shop_product_id\": \"142\",\n      \"shop_variant_id\": \"7261\",\n      \"name\": \"Cool T-shirt - Red\",\n      \"unit_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"total_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"total_price_presentment\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"quantity\": 2,\n      \"image_url\": \"https://placecats.com/neo/300/200.png\",\n      \"grams\": 24,\n      \"is_protected\": true,\n      \"requires_shipping\": true,\n      \"refunded_quantity\": 1,\n      \"refunded_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"refunded_price_presentment\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      }\n    }\n  ]\n}"}]},"children":[]},{"$$mdtype":"Tag","name":"OpenApiResponseSample","attributes":{"descriptionFile":"api-docs-apis/onward.yaml","operationId":"createOrder","responseSamplesResolved":[{"lang":"json","title":"201 application/json","source":"{\n  \"shop_order_id\": \"18282\",\n  \"shop_order_number\": \"W-94713\",\n  \"lookup_key\": \"fa524f69d568a1b2c3d4e5f6\",\n  \"subtotal_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"subtotal_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_discounts_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_discounts_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_shipping_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_shipping_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_tax_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_tax_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_price\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"total_price_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"protection_paid\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"amount_protected\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"amount_protected_presentment\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"created_at\": \"2024-11-26T17:32:28Z\",\n  \"financial_status\": \"paid\",\n  \"source_name\": \"phone\",\n  \"customer\": {\n    \"shop_customer_id\": \"6072418623\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\",\n    \"rewards\": [\n      {\n        \"shop_reward_id\": \"1234567890\",\n        \"balance\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"pending_issuance_balance\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"lifetime_issued\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"lifetime_used\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"lifetime_refunded\": {\n          \"cents\": 1299,\n          \"currency\": \"USD\"\n        },\n        \"redemption_details\": {\n          \"name\": \"shop\",\n          \"type\": \"discount_code\",\n          \"code\": \"ONWARD-e77c3802fd6f9d7d6daae8e286a80f11\",\n          \"url\": \"https://shop.example.com/discount/ONWARD-e77c3802fd6f9d7d6daae8e286a80f11?ref=onward\"\n        },\n        \"balance_updated_at\": \"2019-08-24T14:15:22Z\"\n      }\n    ]\n  },\n  \"shipping_address\": {\n    \"address1\": \"123 Main St\",\n    \"address2\": \"Unit 50\",\n    \"province_code\": \"CA\",\n    \"city\": \"Los Angeles\",\n    \"postal_code\": \"90210\",\n    \"country_code\": \"US\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"line_items\": [\n    {\n      \"shop_line_item_id\": \"816721\",\n      \"shop_product_id\": \"142\",\n      \"shop_variant_id\": \"7261\",\n      \"name\": \"Cool T-shirt - Red\",\n      \"unit_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"total_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"total_price_presentment\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"quantity\": 2,\n      \"image_url\": \"https://placecats.com/neo/300/200.png\",\n      \"grams\": 24,\n      \"is_protected\": true,\n      \"requires_shipping\": true,\n      \"refunded_quantity\": 1,\n      \"refunded_price\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      },\n      \"refunded_price_presentment\": {\n        \"cents\": 1299,\n        \"currency\": \"USD\"\n      }\n    }\n  ]\n}"},{"lang":"json","title":"400 application/json","source":"{\n  \"errors\": [\n    \"Error occurred while parsing request parameters\"\n  ]\n}"},{"lang":"json","title":"401 application/json","source":"{\n  \"error\": \"Unauthorized\"\n}"},{"lang":"json","title":"422 application/json","source":"{\n  \"errors\": [\n    \"Name is required\"\n  ]\n}"}]},"children":[]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":3,"id":"2-onward-calls-you-back-to-report-issuance","__idx":4},"children":["2. Onward calls you back to report issuance"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["When a customer earns cashback, Onward records it in the ledger and calls your \"Issue a reward\" callback API so you can issue the same amount on your side. Depending on your cashback settings this may be immediately or after a configured delay. For example, if your shop issues cashback 15 days after the order, Onward calls you on day 15. Issue the credit when you get the call."]},{"$$mdtype":"Tag","name":"OpenApiCodeSample","attributes":{"descriptionFile":"api-docs-apis/callbacks.yaml","operationId":"issueReward","parameters":{},"environments":{},"codeSamplesResolved":[{"lang":"shell","title":"curl","source":"curl -i -X POST \\\n  https://api.your-store.com/onward/customers/7461/reward \\\n  -H 'Accept: application/json' \\\n  -H 'Content-Type: application/json' \\\n  -H 'X-API-Key: YOUR_API_KEY_HERE' \\\n  -d '{\n    \"customer\": {\n      \"shop_customer_id\": \"7461\",\n      \"first_name\": \"Sally\",\n      \"last_name\": \"Loo\",\n      \"email\": \"sally@example.com\",\n      \"phone_number\": \"+13105551234\"\n    },\n    \"to_issue_amount\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"onward_reward_transaction_id\": 456001\n  }'"},{"lang":"javascript","title":"JavaScript","source":"const shopCustomerId = '7461';\nconst resp = await fetch(\n  `https://api.your-store.com/onward/customers/${shopCustomerId}/reward`,\n  {\n    method: 'POST',\n    headers: {\n      'Content-Type': 'application/json',\n      Accept: 'application/json',\n      'X-API-Key': 'YOUR_API_KEY_HERE'\n    },\n    body: JSON.stringify({\n      customer: {\n        shop_customer_id: '7461',\n        first_name: 'Sally',\n        last_name: 'Loo',\n        email: 'sally@example.com',\n        phone_number: '+13105551234'\n      },\n      to_issue_amount: {\n        cents: 1299,\n        currency: 'USD'\n      },\n      onward_reward_transaction_id: 456001\n    })\n  }\n);\n\nconst data = await resp.json();\nconsole.log(data);"},{"lang":"javascript","title":"Node.js","source":"import fetch from 'node-fetch';\n\nasync function run() {\n  const shopCustomerId = '7461';\n  const resp = await fetch(\n    `https://api.your-store.com/onward/customers/${shopCustomerId}/reward`,\n    {\n      method: 'POST',\n      headers: {\n        'Content-Type': 'application/json',\n        Accept: 'application/json',\n        'X-API-Key': 'YOUR_API_KEY_HERE'\n      },\n      body: JSON.stringify({\n        customer: {\n          shop_customer_id: '7461',\n          first_name: 'Sally',\n          last_name: 'Loo',\n          email: 'sally@example.com',\n          phone_number: '+13105551234'\n        },\n        to_issue_amount: {\n          cents: 1299,\n          currency: 'USD'\n        },\n        onward_reward_transaction_id: 456001\n      })\n    }\n  );\n\n  const data = await resp.json();\n  console.log(data);\n}\n\nrun();"},{"lang":"python","title":"Python","source":"import requests\n\nshop_customer_id = \"7461\"\nurl = \"https://api.your-store.com/onward/customers/\" + shop_customer_id + \"/reward\"\n\npayload = {\n  \"customer\": {\n    \"shop_customer_id\": \"7461\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"to_issue_amount\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"onward_reward_transaction_id\": 456001\n}\n\nheaders = {\n  \"Content-Type\": \"application/json\",\n  \"Accept\": \"application/json\",\n  \"X-API-Key\": \"YOUR_API_KEY_HERE\"\n}\n\nresponse = requests.post(url, json=payload, headers=headers)\n\ndata = response.json()\nprint(data)"},{"lang":"java","title":"Java","source":"import java.net.*;\nimport java.net.http.*;\nimport java.util.*;\n\npublic class App {\n  public static void main(String[] args) throws Exception {\n    var httpClient = HttpClient.newBuilder().build();\n\n    var payload = String.join(\"\\n\"\n      , \"{\"\n      , \" \\\"customer\\\": {\"\n      , \"  \\\"shop_customer_id\\\": \\\"7461\\\",\"\n      , \"  \\\"first_name\\\": \\\"Sally\\\",\"\n      , \"  \\\"last_name\\\": \\\"Loo\\\",\"\n      , \"  \\\"email\\\": \\\"sally@example.com\\\",\"\n      , \"  \\\"phone_number\\\": \\\"+13105551234\\\"\"\n      , \" },\"\n      , \" \\\"to_issue_amount\\\": {\"\n      , \"  \\\"cents\\\": 1299,\"\n      , \"  \\\"currency\\\": \\\"USD\\\"\"\n      , \" },\"\n      , \" \\\"onward_reward_transaction_id\\\": 456001\"\n      , \"}\"\n    );\n\n    var host = \"https://api.your-store.com\";\n    var shopCustomerId = \"7461\";\n    var pathname = \"/onward/customers/%7BshopCustomerId%7D/reward\";\n    var request = HttpRequest.newBuilder()\n      .POST(HttpRequest.BodyPublishers.ofString(payload))\n      .uri(URI.create(host + pathname ))\n      .header(\"Content-Type\", \"application/json\")\n      .header(\"Accept\", \"application/json\")\n      .header(\"X-API-Key\", \"YOUR_API_KEY_HERE\")\n      .build();\n\n    var response = httpClient.send(request, HttpResponse.BodyHandlers.ofString());\n\n    System.out.println(response.body());\n  }\n}"},{"lang":"csharp","title":"C#","source":"using System;\nusing System.Net.Http;\nusing System.Threading.Tasks;\nusing System.Text;\nusing System.Text.Json;\n\npublic class Program\n{\n  public static async Task Main()\n  {\n    System.Net.Http.HttpClient client = new()\n    {\n      DefaultRequestHeaders =\n      {\n        {\"Accept\", \"application/json\"},\n        {\"X-API-Key\", \"YOUR_API_KEY_HERE\"},\n      }\n    };\n\n    string json = JsonSerializer.Serialize(new\n    {\n      customer = new {\n        shop_customer_id = \"7461\",\n        first_name = \"Sally\",\n        last_name = \"Loo\",\n        email = \"sally@example.com\",\n        phone_number = \"+13105551234\"\n      },\n      to_issue_amount = new {\n        cents = \"1299\",\n        currency = \"USD\"\n      },\n      onward_reward_transaction_id = \"456001\"\n    });\n\n    using StringContent postData = new(json, Encoding.UTF8, \"application/json\");\n      var ShopCustomerId = \"7461\";\n    using HttpResponseMessage request = await client.PostAsync(\"https://api.your-store.com/onward/customers/\" + ShopCustomerId + \"/reward\", postData);\n    string response = await request.Content.ReadAsStringAsync();\n\n    Console.WriteLine(response);\n  }\n}"},{"lang":"php","title":"PHP","source":"/**\n * Requires libcurl\n */\n\nconst shopCustomerId = \"7461\";\n$curl = curl_init();\n\n$payload = array(\n  \"customer\" => array(\n    \"shop_customer_id\" => \"7461\",\n    \"first_name\" => \"Sally\",\n    \"last_name\" => \"Loo\",\n    \"email\" => \"sally@example.com\",\n    \"phone_number\" => \"+13105551234\"\n  ),\n  \"to_issue_amount\" => array(\n    \"cents\" => 1299,\n    \"currency\" => \"USD\"\n  ),\n  \"onward_reward_transaction_id\" => 456001\n);\n\ncurl_setopt_array($curl, [\n  CURLOPT_HTTPHEADER => [\n    \"Accept: application/json\",\n    \"Content-Type: application/json\",\n    \"X-API-Key: YOUR_API_KEY_HERE\"\n  ],\n  CURLOPT_POSTFIELDS => json_encode($payload),\n  CURLOPT_URL => \"https://api.your-store.com/onward/customers/\" . shopCustomerId . \"/reward\",\n  CURLOPT_RETURNTRANSFER => true,\n  CURLOPT_CUSTOMREQUEST => \"POST\",\n]);\n\n$response = curl_exec($curl);\n$error = curl_error($curl);\n\ncurl_close($curl);\n\nif ($error) {\n  echo \"cURL Error #:\" . $error;\n} else {\n  echo $response;\n}"},{"lang":"go","title":"Go","source":"package main\n\nimport (\n  \"fmt\"\n  \"bytes\"\n  \"net/http\"\n  \"io/ioutil\"\n)\n\nfunc main() {\n  shopCustomerId := \"7461\";\n  reqUrl := \"https://api.your-store.com/onward/customers/\" + shopCustomerId + \"/reward\"\n  var data = []byte(`{\n    \"customer\": {\n      \"shop_customer_id\": \"7461\",\n      \"first_name\": \"Sally\",\n      \"last_name\": \"Loo\",\n      \"email\": \"sally@example.com\",\n      \"phone_number\": \"+13105551234\"\n    },\n    \"to_issue_amount\": {\n      \"cents\": 1299,\n      \"currency\": \"USD\"\n    },\n    \"onward_reward_transaction_id\": 456001\n  }`)\n  req, err := http.NewRequest(\"POST\", reqUrl, bytes.NewBuffer(data))\n  if err != nil {\n    panic(err)\n  }\n  req.Header.Add(\"Content-Type\", \"application/json\")\n  req.Header.Add(\"Accept\", \"application/json\")\n  req.Header.Add(\"X-API-Key\", \"YOUR_API_KEY_HERE\")\n  res, err := http.DefaultClient.Do(req)\n  if err != nil {\n    panic(err)\n  }\n  defer res.Body.Close()\n  body, err := ioutil.ReadAll(res.Body)\n  if err != nil {\n    panic(err)\n  }\n\n  fmt.Println(res)\n  fmt.Println(string(body))\n}"},{"lang":"ruby","title":"Ruby","source":"require 'json'\nrequire 'uri'\nrequire 'net/http'\nrequire 'openssl'\n\nshop_customer_id = '7461'\nurl = URI('https://api.your-store.com/onward/customers/' + shop_customer_id + '/reward')\n\nhttp = Net::HTTP.new(url.host, url.port)\nhttp.use_ssl = true\n\nrequest = Net::HTTP::Post.new(url)\nrequest['Content-Type'] = 'application/json'\nrequest['Accept'] = 'application/json'\nrequest['X-API-Key'] = 'YOUR_API_KEY_HERE'\nrequest.body = {\n  customer: {\n    shop_customer_id: '7461',\n    first_name: 'Sally',\n    last_name: 'Loo',\n    email: 'sally@example.com',\n    phone_number: '+13105551234'\n  },\n  to_issue_amount: {\n    cents: 1299,\n    currency: 'USD'\n  },\n  onward_reward_transaction_id: 456001\n}.to_json\n\nresponse = http.request(request)\nputs response.read_body\n"},{"lang":"r","title":"R","source":"library(httr)\n\nbody = '{\n   \"customer\": {\n    \"shop_customer_id\": \"7461\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\"\n   },\n   \"to_issue_amount\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n   },\n   \"onward_reward_transaction_id\": 456001\n}'\n\nshop_customer_id = \"7461\"\n\n# create you own operator\n\"%&%\" <- function(x, y)paste0(x,y)\n\nurl = \"https://api.your-store.com/onward/customers/\" %&% shop_customer_id %&% \"/reward\"\n\ndata_req <- POST(\n  url,\n  add_headers(\"Content-Type\" = \"application/json\", \"Accept\" = \"application/json\", \"X-API-Key\" = \"YOUR_API_KEY_HERE\"),\n  body = body,\n  encode = \"json\",\n  verbose()\n)\n\ncontent(data_req)"},{"lang":"json","title":"Payload application/json","source":"{\n  \"customer\": {\n    \"shop_customer_id\": \"7461\",\n    \"first_name\": \"Sally\",\n    \"last_name\": \"Loo\",\n    \"email\": \"sally@example.com\",\n    \"phone_number\": \"+13105551234\"\n  },\n  \"to_issue_amount\": {\n    \"cents\": 1299,\n    \"currency\": \"USD\"\n  },\n  \"onward_reward_transaction_id\": 456001\n}"}]},"children":[]},{"$$mdtype":"Tag","name":"ul","attributes":{},"children":[{"$$mdtype":"Tag","name":"li","attributes":{},"children":[{"$$mdtype":"Tag","name":"strong","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["onward_reward_transaction_id"]}]}," stays the same across retries. If a request repeats an ID you've already seen, return the same ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shop_transaction_id"]}," and don't issue a second credit."]}]},{"$$mdtype":"Tag","name":"OpenApiResponseSample","attributes":{"descriptionFile":"api-docs-apis/callbacks.yaml","operationId":"issueReward","responseSamplesResolved":[{"lang":"json","title":"200 application/json","source":"{\n  \"shop_transaction_id\": \"rw_789\",\n  \"shop_reward_id\": \"1234567890\"\n}"}]},"children":[]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Onward saves ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shop_transaction_id"]}," on the ledger entry as proof the credit was delivered, and uses it to look up that credit later. It saves ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shop_reward_id"]}," on the customer's reward and uses it to address that reward. Return the same ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["shop_reward_id"]}," for every credit that belongs to the same customer. Onward keeps the first one it receives."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Onward treats any other response, or a 200 without a valid shop_transaction_id or shop_reward_id, as a failure and retries."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":2,"id":"how-does-a-customer-spend-cashback","__idx":5},"children":["How does a customer spend cashback?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Your shop decides how customers spend their cashback at checkout. All Onward needs is the amount they spent, which you send with the order. When a customer places the order using their cashback at your checkout, send the amount as ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reward_used"]}," on ",{"$$mdtype":"Tag","name":"MarkdownLink","attributes":{"href":"/apis/onward/orders/createorder"},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["POST /orders"]}]},", in the shop's currency. If the customer's currency is different, add ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reward_used_presentment"]},"."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Spent cashback counts as a discount. Include it in ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["total_discounts_price"]}," and send line item totals with it already taken off. The customer doesn't earn new credit on the part of the order they paid for with their cashback."]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Onward only records as much as the customer's spendable balance covers. The ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reward_used"]}," in the response is what Onward recorded. If it's less than what you sent, your balance and Onward's no longer match."]},{"$$mdtype":"Tag","name":"Heading","attributes":{"level":4,"id":"what-happens-if-the-order-changes","__idx":6},"children":["What happens if the order changes?"]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":[{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reward_used"]}," is the order's running total, not the change since your last report. If an order edit changes how much reward applies, send the new total on ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["PATCH /orders/{shopOrderId}"]},":"]},{"$$mdtype":"Tag","name":"div","attributes":{"className":"md-table-wrapper"},"children":[{"$$mdtype":"Tag","name":"table","attributes":{"className":"md"},"children":[{"$$mdtype":"Tag","name":"thead","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"You send"},"children":["You send"]},{"$$mdtype":"Tag","name":"th","attributes":{"data-label":"Onward"},"children":["Onward"]}]}]},{"$$mdtype":"Tag","name":"tbody","attributes":{},"children":[{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["The same total again"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Records nothing"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A higher total"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Takes the difference off the balance"]}]},{"$$mdtype":"Tag","name":"tr","attributes":{},"children":[{"$$mdtype":"Tag","name":"td","attributes":{},"children":["A lower total"]},{"$$mdtype":"Tag","name":"td","attributes":{},"children":["Credits the difference back"]}]}]}]}]},{"$$mdtype":"Tag","name":"p","attributes":{},"children":["Leaving ",{"$$mdtype":"Tag","name":"code","attributes":{},"children":["reward_used"]}," out of an update leaves the recorded amount as it is."]}]},"headings":[{"value":"Working with Cashback","id":"working-with-cashback","depth":1},{"value":"Before you start","id":"before-you-start","depth":3},{"value":"How does a customer earn cashback?","id":"how-does-a-customer-earn-cashback","depth":2},{"value":"1. Customer places a regular order","id":"1-customer-places-a-regular-order","depth":3},{"value":"2. Onward calls you back to report issuance","id":"2-onward-calls-you-back-to-report-issuance","depth":3},{"value":"How does a customer spend cashback?","id":"how-does-a-customer-spend-cashback","depth":2},{"value":"What happens if the order changes?","id":"what-happens-if-the-order-changes","depth":4}],"frontmatter":{"seo":{"title":"Working with Cashback"}},"lastModified":"2026-10-26T23:29:07.000Z","pagePropGetterError":{"message":"","name":""}},"slug":"/guides/working_with_cashback","userData":{"isAuthenticated":false,"teams":["anonymous"]},"isPublic":true}