Skip to content
Michal Gallovič edited this page Feb 19, 2020 · 1 revision

Create Order

Stripe token is required only if the total of cart is > 0.

Shipping and billing fields are required based on settings in required fields in config/checkout.php

POST /api/orders

parameters: {
  stripe: {
    token: '...'
  },
  order: {
    cart_token: '...' ,
    "customer_email": string|email,
    "shipping_first_name": string,
    "shipping_last_name": string,
    "shipping_address_line1": string,
    "shipping_address_line2": string,
    "shipping_address_city": string,
    "shipping_address_region": string,
    "shipping_address_zipcode": string,
    "shipping_address_phone": string,
    "billing_first_name": string,
    "billing_last_name": string,
    "billing_address_line1": string,
    "billing_address_line2": string,
    "billing_address_city": string,
    "billing_address_region": string,
    "billing_address_zipcode": string,
    "billing_address_phone": string,
  }
}

// standard order response
response: {
  "success": true,
  "data": {
      "token": "f251b832-d1c9-4699-bd4d-eafe72bd7025"
      "order_number": "1"
      "customer_email": "[email protected]"
      "items_total": "3.60"
      "shipping": "0.00"
      "total": "3.60"
      "tax_rate": "0.00"
      "tax": "0.00"
      "discount": "0.00"
      "currency": "USD"
      "shipping_first_name": "First name"
      "shipping_last_name": "Last name"
      "shipping_address_line1": "Street 1"
      "shipping_address_line2": "Line 2"
      "shipping_address_city": "Beverly Hills"
      "shipping_address_region": "California"
      "shipping_address_zipcode": "90210"
      "shipping_address_phone": "123321123"
      "billing_first_name": "First name"
      "billing_last_name": "Last name"
      "billing_address_line1": "Street 1"
      "billing_address_line2": "Line 2"
      "billing_address_city": "Beverly Hills"
      "billing_address_region": "California"
      "billing_address_zipcode": "90210"
      "billing_address_phone": "123321123"
      "status": null
      "customer_notes": null
      "admin_notes": null
      "order_items": [{
          "name": "Product Name"
          "price": "3.60"
          "quantity": "3"
          "product": [{
            "name": "Product Name"
            "image": null
            "price": "1.20"
          }]
      }]
      "order_purchase": {
        "amount": "3.60"
        "card_type": "Visa"
        "card_last4": "4242"
      }
      "created_at": "Feb, 19, 2020"
    ]
  }
}

Get Order

GET /api/orders/{order-token}

response: {...} // standard order response
Clone this wiki locally