WemX API
  • Overview
  • Authentication
  • Ratelimits
  • Errors
  • Parameters
  • API Reference
    • Users
    • Orders
    • Payments
    • Emails
    • Categories
    • Packages
    • Coupons
    • Gateways
    • OAuth Connections
Powered by GitBook
On this page
  1. API Reference

Payments

PreviousOrdersNextEmails

Last updated 1 year ago

Was this helpful?

CtrlK
  • Get all payments
  • Available Relationships (optional)
  • Filters (optional)
  • Sorting (optional)
  • Dates (optional)
  • Generate a payment

Was this helpful?

Get all payments

GET https://wemx.app/api/v1/payments

Returns all payments made on your application

{
    "status": true,
    "current_page": 1,
    "data": [
        {
            "id": "21087b8f-532c-4a83-86ce-35d5406d5932",
            "user_id": 1

Available Relationships (optional)

https://wemx.app/api/v1/payments?include=user,order,price

Available relationships:

user, order, package, price

Filters (optional)

https://wemx.app/api/v1/payments?filter[transaction_id]=test

Available Filters:

id, payment_id, price_id, order_id, user_id, status, type, currency, amount, transaction_id, gateway, data, options

Tip: To filter JSON columns such as gateway, data and options, you can specify the key using ?filter[gateway->driver]=PayPal

Sorting (optional)

https://wemx.app/api/v1/payments?sort[created_at]=asc

Available Sorting Parameters:

description, status, type, currency, amount, options, created_at

Sorting operators

asc, desc, random

Dates (optional)

https://wemx.app/api/v1/payments?date=30days
Operator
Description

today

Get payments created today

yesterday

Get payments created yesterday

3days, 7days, 14days, 30days, 90days

Get payments created last x days

YYYY-MM-DD,YYY-MM-DD

Get payments created between a range of dates

Generate a payment

POST https://wemx.app/api/v1/payments/generate

Generate a payment on your application and redirect the user to pay it

If the payment is generated successfully, the API responds with a list of links in the links object for each gateway that the user can use to directly pay the payment. You can display these links for the user to choose a gateway.

Request Body

Name
Type
Description

user_id*

Numeric

ID of the user for which you want to create payment

description*

String

Short description of the payment

amount*

Numeric

The amount for the payment

data

Array

,
"order_id": 2,
"package_id": 1,
"price_id": 1,
"type": "once",
"description": "Universal",
"status": "paid",
"currency": "USD",
"amount": 5,
"transaction_id": "21087b8f-532c-4a83-86ce-35d5406d5932",
"handler": "App\\Handlers\\NewOrder",
"gateway": {
"id": 1,
"name": "Balance",
"type": "once",
"driver": "Balance",
"class": "App\\Models\\Gateways\\BalanceGateway",
"endpoint": "balance",
"refund_support": 1,
"blade_edit_path": null,
"status": 1,
"created_at": "2024-01-09T18:29:17.000000Z",
"updated_at": "2024-01-09T18:29:17.000000Z",
"default": 0
},
"data": [],
"options": {
"coupon": null
},
"show_as_unpaid_invoice": 0,
"notes": null,
"due_date": null,
"created_at": "2024-01-09T18:29:25.000000Z",
"updated_at": "2024-01-09T18:29:25.000000Z"
}
],
"first_page_url": "http://wemx.app/api/v1/payments?page=1",
"from": 1,
"last_page": 1,
"last_page_url": "http://wemx.app/api/v1/payments?page=1",
"links": [
{
"url": null,
"label": "Previous",
"active": false
},
{
"url": "http://wemx.app/api/v1/payments?page=1",
"label": "1",
"active": true
},
{
"url": null,
"label": "Next",
"active": false
}
],
"next_page_url": null,
"path": "http://wemx.app/api/v1/payments",
"per_page": 15,
"prev_page_url": null,
"to": 2,
"total": 2
}

Pass custom data as an array

notes

String

Write a note about the payment

show_as_invoice

Boolean

Show the payment as an invoice on the application

{
    "success": true,
    "payment": "43d5c727-df50-4826-8c33-01d4e5213fd4",
    "links": [
        {
            "Balance": "https://wemx.app/payment/invoice/43d5c727-df50-4826-8c33-01d4e5213fd4/pay?gateway=1"
        },
        {
            "PayPal": "https://wemx.app/payment/invoice/43d5c727-df50-4826-8c33-01d4e5213fd4/pay?gateway=2"
        },
        {
            "Tebex": "https://wemx.app/payment/invoice/43d5c727-df50-4826-8c33-01d4e5213fd4/pay?gateway=3"
        },
        {
            "Tebex": "https://wemx.app/payment/invoice/43d5c727-df50-4826-8c33-01d4e5213fd4/pay?gateway=4"
        },
        {
            "stripecheckout": "https://wemx.app/payment/invoice/43d5c727-df50-4826-8c33-01d4e5213fd4/pay?gateway=7"
        },
        {
            "Pay By Link": "https://wemx.app/payment/invoice/43d5c727-df50-4826-8c33-01d4e5213fd4/pay?gateway=9"
        }
    ]
}