Submitting a Direct Order with a Payment Method
Direct order submission enables channels who calculate their own tax and shipping rates to submit fully composed orders in a single request. For most commerce platforms, the prices you provide in the order submission request will override the built-in pricing engine of the platform. This ensure’s that the merchants system of record and automated customer communication (ex. order confirmation emails) remain accurate.
This guide goes through the steps needed to compose an Order and directly submit it to the merchant through Violet.
Retrieve SKUs from the Violet Catalog
Retrieve SKUs you are able to sell through the Violet Catalog APIs
Capture Shopper Information
Capture Shopper information through your UI elements. At a minimum, you will need the following:
- First Name
- Last Name
- Shipping Address
You will need to submit this information as a part of the Create Order endpoint. Optionally, if “Billing Address” is different to the “Shipping Address”, those details can also be added to the request body.
Estimate Cart Prices
Estimate Cart prices using the Estimate Cart endpoint. You will need to input the information that was previously collected from the Shopper.
-
Estimate Cart
-
Sample Response
Adding a Payment Method
If you are bypassing payments (i.e. not using Violet to orchestrate payments and payouts), you do not need to include a payment method. When creating an Order in the next step, simply leave out the payment_method
in the request.
Violet supports accepting two forms of payment method when creating Orders.
- Single-use Card Tokens
- Pre-authorized Stripe Payment Intents
Creating a Single-use Card Token
Capture Shopper Credit Card information using Stripe JS Elements and create a Stripe Token:
Alternatively, if you’re using a different user input form to collect and store shopper credit card information, you can call the Stripe API directly to create a token
For the token to be accepted during Checkout, you’ll need to ensure that its created using the Stripe Public Key that is associated with the same Stripe account being used for payment orchestration. If this is Violet’s Account, please reach out to us for this key.
Using a pre-authorized Payment Intent
This payment method can only be used if you’ve connected your pre-existing Stripe Platform account to Violet. Learn more about this here.
Create a payment intent with Stripe
Start with creating a payment intent in Stripe using the Payment Intents API. This must be done on the same account you used to onboard with Violet Payments. Ensure that the amount and currency, match that of the Order you will be creating. Additionally, Violet requires that the payment intent is marked for manual capture. For example:
Store the payment intent ID that Stripe returns in the response.
Add a payment method to the Payment Intent
A payment method must be added to the payment intent prior to it being used when creating an Order. To do this, you can use Stripe.js Elements, or the update Payment Intents API.
Alternatively, you can modify the call in the previous step to include a payment method on payment intent create. For example:
Authorize the payment intent
Authorize the payment intent by calling the Confirm Payment Intent API. This ensures that this is not a fraudulent payment method and that there are sufficient funds for this purchase. Alternatively, if Stripe.js Elements were used to capture the shopper payment method, Stripe may have automatically authorized the shopper payment method. Once a payment intent is authorized, its amount cannot change.
Include the payment intent when calling Create Order
When creating an Order using the API below, include the payment intent as a payment method. For example:
Creating the Order
Call the Violet Create Order endpoint with the information collected above to create an Order:
The following information must be included to create an Order:
- First Name
- Last Name
- Shipping Address
- Bag(s)
For a multi-merchant Order, multiple bags must be created in the Order payload. Each Bag must contain items from only one merchant and have its own shipping method.
-
Sample Request
billing_address
is optional in the request above. If left out, the shipping_address
will be used as the billing_address
for the Order.
If Order submission succeeds, Violet will respond with a completed Cart.
-
Sample Response
If there are any issues with submission, they will be returned to instead of the Order above. A new payment token will need to be sent with each Create Order request.
Was this page helpful?