An order billing transaction is created when a transaction was sent to a payment provider. A transaction holds information about the actual payment, while a billing holds information about the billing address. A billing can have one to many transactions. For example, if an order was paid for with two different credit cards, there would be two transactions.

​Use the Order Billing Transactions API to retrieve information about the payment of orders, like the amount, payment processor, currency, credit card, and status.

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
order_billing_transaction_id ​The unique transaction ID (within the billing) of the transaction. integer X
method Type of billing transaction.
Valid values are:
  • purchase: order was purchased
  • void: order was cancelled
  • refund: order was returned and refunded
string
status Status of the transaction.
Valid values are:
  • success
  • failure
  • note: The transaction required manual intervention by the merchant.
string
amount Amount of this transaction. integer
currency Currency used for this transaction. string
tx_fee Any fee charged for this transaction. string
tx_id An external ID for the transaction, often provided by the payment processor. string
tx_message Message sent from the payment provider associated with this transaction. string
cc_type Type of credit card used for this transaction.
Valid values are:
  • American Express
  • Visa
  • Mastercard
  • Discover
  • PayPal
  • Diners Club
  • JCB
​Returns false if a credit card was not used.​
string
cc_last_4 Last four digits of the credit card used for this transaction. Returns false if a credit card was not used. string
created_date Date the transaction was created Unix GMT Timestamp
updated_date Date the transaction was last updated Unix GMT Timestamp

GET
Retrieve a List of Billing Transactions

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

Returns all transactions for the given billing. Only list fields are returned.


scope: read:store-orders

Example CURL request returning all transactions:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/456789/billings/1/transactions \
--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,
        "order_billing_transaction_id": 1
    },
    {
        "user_id": "123456",
        "site_id": "987654321",
        "order_id": "456789",
        "order_billing_id": 1,
        "order_billing_transaction_id": 2
    }
]

GET
Retrieve the Number of Transactions for a Billing

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

Returns the number of transactions for a 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/transactions/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 a Billing Transaction

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

Returns all fields for the given transaction.


scope: read:store-orders

Example CURL request:

curl --request GET \
--url https://api.weebly.com/v1/user/sites/987654321/store/orders/456789/billings/1/transactions/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 transaction are returned.

{
    "user_id": "123456",
    "site_id": "987654321",
    "order_id": "456789",
    "order_billing_id": "1",
    "order_billing_transaction_id": "1",
    "method": "purchase",
    "status": "success",
    "amount": 700,
    "currency": "USD",
    "tx_fee": 0,
    "tx_id": "ch_16pmkuKRCoO7IeaFWfKff7Zm",
    "tx_message": "Transaction approved",
    "cc_type": "Visa",
    "cc_last_4": "4242",
    "created_date": 1443389544,
    "updated_date": 1443389545
}

Help make these docs better!









Tags: