End to end API flow / Quickstart Instructions
Step 0. Create a Customer via Slope API
Create a customer that the order will be attached to.
POST https://api.slope.so/v3/customers HTTP/1.1
{
"email": "[email protected]",
"externalId": "<your_customer_unique_identifier>",
"phone": "+14151234567",
"businessName": "Stark Industries, Inc",
"address": {
"line1": "200 Park Avenue",
"city": "New York",
"state": "NY",
"postalCode": "10166",
"country": "US"
}
}
Step 1. Create an Order via Slope API
Create an order for whatever amount needs to be paid or financed.
POST https://api.slope.so/v3/orders HTTP/1.1
{
"total": 1000,
"currency": "USD",
"externalId": "<your_order_unique_identifier>",
"items": [
{
"sku": "CL-SOCKS-2",
"unitPrice": 500,
"quantity": 2
}
],
"customerId": "<slope_customer_id>"
}
Step 2. Generate an order intent via Slope API
Generate an order intent token, that allows the Slope widget to be completed by the customer.
Order intent tokens expire
Order intent tokens expire after four hours. We recommend you generate the order intent token right before displaying the Slope widget.
If an expired secret is passed to the Slope Popup the
onFailure
callback with aORDER_INTENT_EXPIRED
secret. You must generate a new one your server and re-initialize the popup.
On your server:
POST http://api.slope.so/v3/orders/{{orderId}}/intent HTTP/1.1
Step 3. Open the Slope widget for the Customer to complete
Using the {{ORDER_INTENT_SECRET}}
from Step 2, initialize Slope's widget. On the front-end:
<!-- embed our library -->
<script src="https://checkout.slope.so/slope.min.js"></script>
<!-- initialize the widget and open it -->
<script type="text/javascript">
window.initializeSlope({
intentSecret: ORDER_INTENT_SECRET,
})
</script>
<button onclick="window.Slope.open()">Pay with Slope</button>
Full reference here. The customer will select payment terms, a payment method, and accept any Terms and Conditions that are necessary - the order will be in the open
state after the Customer has completed the widget.
Step 4. Finalize the order via Slope API
Finalize an order once you have confirmed the order is ready.
POST https://api.slope.so/v3/orders/{{ORDER_ID}}/finalize HTTP/1.1
Updated 3 months ago