Sell a Thing

I just wanna sell a thing. How is that hard? It's not!

One of the the simplest flows you can make with our Building Blocks is to have a customer buy something. We're going to go through that flow step by step. For simplicity's sake, we're assuming you have your authentication and payment solutions in place already.

Let's pretend you're selling used DVDs, because that's super relevant. You're going to do these things:

  1. Create a user

  2. Create a product

  3. Make an order

  4. Pay for it.

Create a User

Eventually, you'll want to check out the User Object and all the related endpoints you can hit. But, to just create a new user, call the /v2/users endpoint with a JWT. Thereafter, that will log in the existing user.

Argument

Type

Description

first_name

string

First name of the user.

last_name

string

Last name of the user.

salutation

string

Title of the user.

email

string

E-mail of the user.

mobile_phone_number

string

Phone number of the user.

addresses

array

An array of Addresses associated with the user.

billing_address

object

Billing Address of the user.

bio

string

Biographical note about the user.

tags

array

List of tags associated with the user.

note

string

Additional notes regarding the user.

Create a Product

You create products through the dashboard. It's very simple. Under the Orders tab, you'll see Products. Near the top will be New product +. Click that and give it a name, set the price and VAT. You're then taken to that product's details, which you can fill in to your heart's content. Pop over to the Products and see all its associated endpoints when you're ready.

Make an Order

Aka, Create an Order. Check out the Order Object and all its related endpoints for more info. But if you're just trying to make an order for a couple DVDs, you use /orders.

Body Parameters

Type

Description

currency

string

3 letter ISO currency code as defined by ISO 4217.

billing_address

object

Address used for billing purposes.

deliveries

array

Used to store the delivery history for an order.

delivery_address

object

Address used for delivery.

delivery_status

string

See delivery statuses. Default is PENDING.

delivery_time

object

Expected arrival time for delivery, timestampformat.

order_status

string

See order statuses. Default is CREATED.

items

array

List of items associated with an order.

human_id

string

Human readable ID that identifies the order easily, e.g. 3AG7UA.

payments

array

List of Payment objects associated with order.

payment_method

object

See Payment Methodfor more info on the payment method object.

resources

array

The resources in the order.

top_up_amount

number

Extra amount added to total_amount to fulfill the company’s minimum order value.

top_up_vat

float

The VAT percentage on the top_up_amount. Decimal from 0.0 to 1.0, e.g. 0.25 = 25%.

total_amount

float

Amount with two decimals. e.g., 12.34. The amount is automatically calculated based on items in the order.

total_quantity

number

Total number of products in an order, e.g. 3 spoons and 2 forks = 5 products.

units

number

Number of unique products in an order, e.g. 3 spoons and 2 forks = 2 product units.

accounting_reference

string

An accounting reference ID.

stripe_charge_id

string

The reference ID from a Stripe charge.

stripe_refund_id

string

The reference ID from a Stripe refund.

subscription

object

AssociatedSubscription referenced by subscription_id.

Get Paid

The fun part. Check out Payment Methods and Payments for all the parameters and related endpoints, as there are a few parts to getting paid. Here's the gist.

1. User adds a card

Your user will need to add a payment method, i.e. a credit or debit card, that they want to use to pay for their order.

Attribute

Type

Description

payment_method

string

Must be stripe for triggering a Stripe payment method.

token

string

Token created with the card details (number, expiration month, expiration year, card verification code).

2. Pay the order

To pay an order, you're going to hit /payments with the order ID and the payment method ID. Again, check out Payment Methods and Payments for more details.

Arguments

Type

Description

orders

array

List with orders to be paid.

payment_method

string

The payment method ID that you want to use.

And that's it. If the payment for the order is successful, the order_status will change to SUCCESS.

Last updated