An Order Billing represents information given to a payment provider for an order. For example, it contains the name, billing address, and email that the customer entered as their billing information. An order can have more than one billing when more than one payment method was used. Billings have one or more transactions that represent the money paid for the order.

Use the Order Billings API to retrieve payment information like billing address or payment provider for payments against an order.

Fields

The following table shows all fields that exist for this API and those that are returned when you retrieve a list. All fields are returned when you retrieve a single item.

Name Description Type List
user_id The unique ID of the authenticated user string X
site_id ID of a Weebly site, unique to the currently authenticated user​ string X
order_id ​The unique order ID (within the store) of the order. string X
order_billing_id The unique billing ID (within the order) of the billing. integer X
gateway The payment provider used for this billing. string
full_name Customer's full name. string X
email Customer's email. string
phone Customer's phone. string
business_name Business name of the customer, if used. string
street Billing street address entered by customer. string
street2 Second line of billing street address, if used. string
city Billing city entered by customer. string
region Billing state or region entered by customer. string
country Billing country entered by customer. string
postal_code Billing postal code entered by customer string
transactions An array of billing transactions. array
created_date Date the billing was created. Unix GMT Timestamp
updated_date Date the billing was last updated. Unix GMT Timestamp

GET
Retrieve a List of Billings for an Order

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}/billings

Returns all billings for the given order. Only list fields are returned.


scope: read:store-orders

Example CURL request returning billings:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/456789/billings \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

[
    {
        "user_id": "123456",
        "site_id": "987654321",
        "order_id": "456789",
        "order_billing_id": 1,
        "full_name": "John Doe"
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "order_id": "456789",
        "order_billing_id": 2,
        "full_name": "John Doe"
    }
]

GET
Retrieve the Number of Billings for an Order

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}/billings/count

Returns the number of billings for an order.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/456789/billings/count \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

{
    "count": 2
}

GET
Retrieve Details for an Order's Billing

GET /v1/user/sites/{SITE_ID}/store/orders/{ORDER_ID}/billings/{ORDER_BILLING_ID}

Returns all fields for the given billing.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/456789/billings/1 \
--header 'accept: application/vnd.weebly.v1+json' \
--header 'content-type: application/json' \
--header 'x-weebly-access-token: [YOUR_TOKEN]"

Example response:

See Fields table. All fields for the billing are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "order_id": "456789",
    "order_billing_id": "1",
    "gateway": "Stripe",
    "full_name": "John Doe",
    "email": "johndoe@email.com",
    "phone": "555-555-5555",
    "business_name": null,
    "street": "460 Bryant St.",
    "street2": null,
    "city": "San Francisco",
    "region": "CA",
    "country": "US",
    "postal_code": "94107",
    "created_date": 1443389596,
    "updated_date": 1443389596,
    "transactions": [
        {
            "order_id": "45678",
            "order_billing_id": 1,
            "order_billing_transaction_id": 1,
            "method": "purchase",
            "status": "success",
            "amount": 200,
            "currency": "USD",
            "tx_fee": 0,
            "tx_id": "ch_16pmlkKRCoO7IeaFIw1qsH4p",
            "tx_message": "Transaction approved",
            "cc_type": "Visa",
            "cc_last_4": "4242",
            "user_id": "123456",
            "site_id": "987654321",
            "created_date": 1443389596,
            "updated_date": 1443389596
        }
    ]
}

Help make these docs better!









Tags: