{"metadata":{"image":[],"title":"","description":""},"api":{"url":"","auth":"required","results":{"codes":[]},"params":[],"method":"get"},"next":{"description":"","pages":[]},"title":"Offline Order Integration","type":"basic","slug":"offline-order-integration","excerpt":"","body":"The Apruve API allows you to integrate third-party systems with Apruve to enable offline orders. We call the standard, eCommerce customer-driven checkout an \"online\" order. \"Offline\" orders are created by a customer service representative on behalf of the customer. This is normally managed in the admin console of an eCommerce system, CRM or ERP.\n\nThere are two types of flows, depending on the business type of the merchant and the types of products being sold. The example below if for physical goods. See the [\"Alternate Flow\"](#section-alternate-flow) section below for other options.\n\nBelow is an example of a form which allows you to select a customer, add products to the order, and place the order.\n\n![](https://s3.amazonaws.com/apruve-documentation-resources/offline_orders.png)\n\nIn this case Apruve is assumed to be the default payment method. Most systems would have several payment methods to choose from. \n\nBelow is a description of the steps necessary to integrate this type of flow with Apruve. \n\n# Prerequisites\n\n * The Merchant must have a merchant account set up with Apruve to be able to use the Apruve APIs\n * The customer must have an Apruve account which establishes a line of credit with the merchant.\n * The customer must be identifiable by the same email address in both systems\n\n# Step 1: Identify the Customer\n\nThe customer is identified in Apruve by their email address. This is the email address that they used when they applied for a corporate account with Apruve. The merchant system must be able to supply this email address to Apruve to identify the customer. Apruve supplies an API that allows you to look up their Apruve account information by email address. \n\nThe documentation for this API can be found [here](ref:get_merchants-id-corporate-accounts).\n\nThe API signature looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"GET /merchants/{id}/corporate_accounts{?email}\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\nThe `{id}` parameter needs to be replaced with the merchant ID from your merchant account, and the email parameter would be set to the customer's email address. The API returns a corporate account ID, which can then be used to place an order. If the customer is not found by the API, then they do not have an Apruve account and so they will not be allowed to check out using Apruve as a payment method.\n\n# Step 2: Create an Order\n\nOnce the customer is identified you can create an order on their behalf. The Create Order API is documented [here](ref:post_orders).\n\nThe API signature looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /orders\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\nThe body of the request contains information about the merchant, the order, and the corporate account ID obtained in step 1. See the documentation linked above for more information. If the order is placed successfully the API will return the Apruve order ID, which can be stored in the merchant's system. This will allow you to make additional API calls to manage the order status. If the order cannot be placed (for example if the customer does not have enough credit) the API will return an error message. \n\n# Step 3: Wait for the Order to be approved\n\nWhen an order is placed on behalf of the customer they will receive an email which allow them to approve or deny the order. When the order is approved we will send a [Webhooks](doc:webhooks) back to the Merchant system to indicate that the order is ready to be fulfilled. Usually this will trigger the order status to be updated in the merchant system. \n\n# Step 4: Create an Invoice\n\nApruve relies on a shipment notification before we start our invoicing process. We also need an invoice which matches the items contained in the shipment. It is generally best to wait until the items are shipped before you create an invoice so you can ensure that they match exactly, but this is not required.\n\nTo create an invoice you would call the Create Invoice API, which is documented [here](ref:post_invoices-id-issue). \n\nThe API signature looks like this:\n[block:code]\n{\n  \"codes\": [\n    {\n      \"code\": \"POST /orders/{order_id}/invoices\",\n      \"language\": \"ruby\"\n    }\n  ]\n}\n[/block]\nCalling this API is very similar to the Create Order API. You pass in the order ID and information about the items that are included in the shipment. The API then returns the invoice ID in the response, which will be used for the next API call\n\n# Step 5: Create a Shipment\n\nTo create a shipment notification you simply have to call our Shipment API with information about the items that are included in the shipment.\n\nNote: Orders can have multiple shipments associated with them. \n\nThe Create Shipment API is very similar to the Create Invoice API, but it also allows you to send tracking information for shipment.\n\nThis API is documented [here](ref:post_invoices-invoice-id-shipments).\n\n# Alternate Flow\n\nThe Alternate flow is similar to what is described above but without the customer approval process. There are some scenarios where the approval is not necessary (for example: paying for services rendered). \n\nThe steps for this flow are as follows:\n\n## Step 1: Identify the Customer\n\nSame as above\n\n## Step 2: Create an Order\n\nSame as above, except that when the order is created, the `invoice_on_create` flag is set to true. This will create an invoice without further API calls.\n\n\n####That's it! \n\nCheck out our other developer guides for more information about integrating with Apruve.","updates":[],"order":4,"isReference":false,"hidden":false,"sync_unique":"","link_url":"","link_external":false,"_id":"598362b25de0a1002049efa8","project":"58b9e955fba7da250056ff86","version":{"version":"4.0","version_clean":"4.0.0","codename":"","is_stable":true,"is_beta":false,"is_hidden":false,"is_deprecated":false,"categories":["58b9e955fba7da250056ff8a","58b9e9e168a4a5190011dcc2","58b9ea1de87271190074c623","58b9f9df4022e60f00ae20af","58bda4f77181082500275455","58bda69b8bcd092f00e52862","58bda751b4e9640f00e4bdaf","58e800fabc0deb0f002801f3","5925bfd9504e5239003807f4","5925c026aef9fd27008525c0","5925c0e7dd71b51b00ccc329","592d872451a3e80f00eb4a1a","592d9539b9b6b91900569ea0","592d990a51a3e80f00eb4c25","592d9bf480832f0f00ddfa46","592d9d5051a3e80f00eb4e02","592dbd5cd97832190073d76a","598360d76050430034ef4e07","598363237c926c0028d2e420","598363755de0a1002049efad","598363c27c926c0028d2e442","59c15f2ebc639a0032f770f0"],"_id":"58b9e955fba7da250056ff89","releaseDate":"2017-03-03T22:08:21.880Z","__v":22,"createdAt":"2017-03-03T22:08:21.880Z","project":"58b9e955fba7da250056ff86"},"category":{"sync":{"isSync":false,"url":""},"pages":[],"title":"Developer Resources","slug":"developer-resources-1","order":2,"from_sync":false,"reference":false,"_id":"598360d76050430034ef4e07","project":"58b9e955fba7da250056ff86","version":"58b9e955fba7da250056ff89","isAPI":false,"createdAt":"2017-08-03T17:43:51.991Z","__v":0},"user":"59232ee4e465c11900921e8a","createdAt":"2017-08-03T17:51:46.018Z","githubsync":"","__v":0,"parentDoc":null,"updatedAt":"2017-08-04T18:08:56.010Z"}

Offline Order Integration


The Apruve API allows you to integrate third-party systems with Apruve to enable offline orders. We call the standard, eCommerce customer-driven checkout an "online" order. "Offline" orders are created by a customer service representative on behalf of the customer. This is normally managed in the admin console of an eCommerce system, CRM or ERP. There are two types of flows, depending on the business type of the merchant and the types of products being sold. The example below if for physical goods. See the ["Alternate Flow"](#section-alternate-flow) section below for other options. Below is an example of a form which allows you to select a customer, add products to the order, and place the order. ![](https://s3.amazonaws.com/apruve-documentation-resources/offline_orders.png) In this case Apruve is assumed to be the default payment method. Most systems would have several payment methods to choose from. Below is a description of the steps necessary to integrate this type of flow with Apruve. # Prerequisites * The Merchant must have a merchant account set up with Apruve to be able to use the Apruve APIs * The customer must have an Apruve account which establishes a line of credit with the merchant. * The customer must be identifiable by the same email address in both systems # Step 1: Identify the Customer The customer is identified in Apruve by their email address. This is the email address that they used when they applied for a corporate account with Apruve. The merchant system must be able to supply this email address to Apruve to identify the customer. Apruve supplies an API that allows you to look up their Apruve account information by email address. The documentation for this API can be found [here](ref:get_merchants-id-corporate-accounts). The API signature looks like this: [block:code] { "codes": [ { "code": "GET /merchants/{id}/corporate_accounts{?email}", "language": "ruby" } ] } [/block] The `{id}` parameter needs to be replaced with the merchant ID from your merchant account, and the email parameter would be set to the customer's email address. The API returns a corporate account ID, which can then be used to place an order. If the customer is not found by the API, then they do not have an Apruve account and so they will not be allowed to check out using Apruve as a payment method. # Step 2: Create an Order Once the customer is identified you can create an order on their behalf. The Create Order API is documented [here](ref:post_orders). The API signature looks like this: [block:code] { "codes": [ { "code": "POST /orders", "language": "ruby" } ] } [/block] The body of the request contains information about the merchant, the order, and the corporate account ID obtained in step 1. See the documentation linked above for more information. If the order is placed successfully the API will return the Apruve order ID, which can be stored in the merchant's system. This will allow you to make additional API calls to manage the order status. If the order cannot be placed (for example if the customer does not have enough credit) the API will return an error message. # Step 3: Wait for the Order to be approved When an order is placed on behalf of the customer they will receive an email which allow them to approve or deny the order. When the order is approved we will send a [Webhooks](doc:webhooks) back to the Merchant system to indicate that the order is ready to be fulfilled. Usually this will trigger the order status to be updated in the merchant system. # Step 4: Create an Invoice Apruve relies on a shipment notification before we start our invoicing process. We also need an invoice which matches the items contained in the shipment. It is generally best to wait until the items are shipped before you create an invoice so you can ensure that they match exactly, but this is not required. To create an invoice you would call the Create Invoice API, which is documented [here](ref:post_invoices-id-issue). The API signature looks like this: [block:code] { "codes": [ { "code": "POST /orders/{order_id}/invoices", "language": "ruby" } ] } [/block] Calling this API is very similar to the Create Order API. You pass in the order ID and information about the items that are included in the shipment. The API then returns the invoice ID in the response, which will be used for the next API call # Step 5: Create a Shipment To create a shipment notification you simply have to call our Shipment API with information about the items that are included in the shipment. Note: Orders can have multiple shipments associated with them. The Create Shipment API is very similar to the Create Invoice API, but it also allows you to send tracking information for shipment. This API is documented [here](ref:post_invoices-invoice-id-shipments). # Alternate Flow The Alternate flow is similar to what is described above but without the customer approval process. There are some scenarios where the approval is not necessary (for example: paying for services rendered). The steps for this flow are as follows: ## Step 1: Identify the Customer Same as above ## Step 2: Create an Order Same as above, except that when the order is created, the `invoice_on_create` flag is set to true. This will create an invoice without further API calls. ####That's it! Check out our other developer guides for more information about integrating with Apruve.