Create an order
To create a new order programmatically, you need to send a POST request to our REST API endpoint.
Implementation
This guide will feature implementations in JavaScript, Python, and PHP, but these snippets can be translated to almost any other language by following the Reference section.
Make sure you have a secret API key
If you don't have one, you can create it in the Merchant Panel. Read here for more information.
Install dependencies if needed
If you don't have a preferred language, we recommend using JavaScript. Most modern browsers and runtimes have Fetch API built-in, which is a modern way to make HTTP requests.
If you need to use a different language, you can use a package manager like pip
to install the requests
library for Python or curl
for PHP.
Refer to your language's documentation for more information.
Handle the response
The JSON response contains important information about the created order.
Here's what you'll receive:
You can use the acsUrl
to redirect your customers to the widget directly, or use orderToken
alongside other widget settings for embedded widget integrations.
Reference
URL
POST https://api.swipelux.com/api/orders/createPrepared
Request headers
Header | Value | Required |
---|---|---|
Authorization | Your secret API key | Yes |
Request body
Root object
Prop | Type | Default |
---|---|---|
externalId? | string | - |
targetAddress | string | - |
user | object | - |
amounts | object | - |
amounts
object
Prop | Type | Default |
---|---|---|
to.currency | string | - |
from.amount | number | - |
from.currency | string | - |
user
object
Prop | Type | Default |
---|---|---|
email? | string | - |
phone | string | - |