Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Loading...
Welcome to the FlexShopper API. We're excited to partner with you!
There are two ways to integrate with FlexShopper:
Medusa, our REST API, is suitable for you either if you don't have a web application, or if you're simply seeking more control over your visual interface. Medusa enables you to integrate with FlexShopper while preserving your own application's look and feel.
We strongly recommend using the Medusa integration.
, the suite of web components and iframe, is suitable for you if you already have a customer-facing web application UI. This integration is typically the easiest of the two, but requires you to already have a web application to embed Payment Plugin into as an iframe.
Medusa
A powerful REST API that you can call from anywhere.
Payment Plugin
A comprehensive iframe for your web app.


Retrieve all payment methods associated with the authenticated customer.
GET /v3/customers/me/payment-methods
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data[].cardBrand
string
Brand of the card
data[].lastFour
string
Last four digits of the card or account
data[].firstSix
string
First six digits of the card
data[].label
string
Label for the payment method
customer-token
string
Customer's authentication token
x-version-override
string
N/A
data
array
N/A
data[].id
string
Payment Method Id
data[].type
string
[
{
"id": "5910c6805bffb3590e07cc1e",
"type": "card",
"cardBrand": "Visa",
"lastFour": "1234",
"firstSix": "411111",
"label": "My Visa Card"
}
]Type of payment method
Determines if the user already exists or not
GET /v3/user-exists
The details below help you form your HTTP requests to this endpoint.
You may provide query parameters to filter the output.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
string
N/A
data
object
N/A
data.userId
string
User Id
data.exists
boolean
{
"data": {
"userId": "1234-asdf-4321-fdsa",
"exists": true
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}Determines if the user exists or not
Get a one-time use API key for tokenizing with LPP
Gets a Clover tokenization key (PKMS key)
GET /v3/gateways/clover/pkms
The details below help you form your HTTP requests to this endpoint.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
string
N/A
{
"data": "182acs90ujo21mklcajsk"
}You may need to provide specific headers.
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
You must provide a JSON payload.
firstName
string
User's first name
lastName
string
User's last name
string
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
data.userId
string
User id
data.token
string
You may need to provide specific headers.
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
The endpoint path expects parameters.
userId
string
N/A
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
{
"data": {
"token": "\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1YTk..."
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
The response's schema is outlined below.
data
object
N/A
data.token
string
Customer's authentication token
Confirms shipment for item(s) in a lease.
POST /v3/transactions/{transactionId}/confirm-shipment
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The endpoint path expects parameters.
You must provide a JSON payload.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
Medusa is a REST API that enables you to authenticate your user, apply for a spending limit, create a lease, sign the lease, and perform other operations on behalf of the user.
The base URLs for Medusa are listed below according to the environment:
Sandbox
FlexShopper must issue you an API token. You must provide your API token in the Authorization header with every call to Medusa.
The following guide walks you through the end-to-end journey of the customer through Medusa, and outlines the required steps to complete this journey.
The customer must exist in Medusa and have a payment method on file. You'll need a customer authentication token for actions such as applying for a spending limit, creating a lease, and signing the lease.
Once your customer is in Medusa, it's time to ensure they have an active decision, a spending limit, and are not on a spending hold.
An active decision ensures your customer has is allowed to create and sign leases.
The spending limit amount helps you understand what your customer's maximum order value is, as you won't be able to create a lease for them with a total higher than the spending limit.
A spending hold may be applied by FlexShopper to customers for various reasons. If a customer has a spending hold applied, no new leases will be created for them.
Now that your customer is created, and has an active decision and an available spending limit, you can proceed with the lease process.
Finalize a transaction
POST /v3/transactions/{transactionId}/finalize
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The endpoint path expects parameters.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
Checks if given ACH info is valid
POST /v3/paymentMethods/{userId}/verifyACH
The details below help you form your HTTP requests to this endpoint.
The endpoint path expects parameters.
You must provide a JSON payload.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
{
"data": {
"userId": "5a319511a86980001d602095",
"token": "eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1YTk..."
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 409,
"code": "UserAlreadyExists",
"message": "The user already exists",
"data": {}
}
}Users email address to authenticate with
password
string
User password to authenticate with
resetPassword
boolean
Determines if password reset e-mail will be send
locale
string
Language part of the user locale, not the full locale.
User authorization token
If your customer aleady exists in Medusa, you can obtain a customer authentication token by calling the Create Authorization Token endpoint. The user's ID you'll need for this endpoint is returned from the Verify User Exists endpoint.
If your customer doesn't exist and you need to perform a customer action, then you must create a customer by calling the Create User endpoint. If the customer is successfully created, their ID and customer authentication token will be returned.
Once a customer is created, you must collect their payment method(s) and provide them to Medusa.
You can provide the payment methods in the payload when applying for a spending limit, or you can interact with the Add Payment Method endpoint. You may use that endpoint at any point after creating a customer.
Generally, the customer must have at least one payment method in Medusa to complete this flow.
If no decision is returned, then you must apply for a spending limit for this customer. You can do that by calling the Apply for Spending Limit endpoint.
If your customer is approved to spend, you can proceed with creating a lease. If the customer is denied, then they unfortuantely cannot proceed.
Once a lease is created and presented to the user, you must give them the option to sign it virtually. Then, when the customer signs the lease on your end, you must subsequently sign the lease through Medusa by calling the Sign Lease endpoint.
After the lease is signed, the lease must be finalized (confirmed). This can be done by calling the Finalize Lease endpoint.
Once a lease is finalized, we begin the fulfillment and billing processes.
Finally, the fulfillment of the lease must be confirmed. For E-commerce integrations, this step must be done after you've confirmed the order is shipped. Confirmation is generally done by calling the Confirm Shipment endpoint.
Production
data.leaseNumber
string
N/A
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
transactionId
string
The transaction ID provided at lease generation.
data
object
N/A
data.transactionId
string
N/A
data.loanNumber
string
{
"data": {
"transactionId": "ABC-129384",
"loanNumber": "1234567",
"leaseNumber": "1234567"
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 404,
"code": "LeaseNotFound",
"message": "The lease requested was not found",
"data": {}
}
}N/A
items[].carrier
string
The carrier handling the item's shipment.
items[].shipDate
string
The date shipped to the carrier.
items[].deliveryDate
string
The date shipped to the carrier.
items[].quantity
number
Quantity, defaults to the number ordered if not present.
items[].trackingLink
string
A link to track the shipment on the carrier's website.
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
transactionId
string
The transaction ID provided at lease generation.
items
array
The list of items to be confirmed.
items[].sku
string
Item's sku
items[].trackingNumber
string
data
object
N/A
The tracking number
userId
string
Customer Id
accountNumber
string
user ACH account number
routingNumber
string
user ACH routing number
data
object
N/A
data.accountResponseCode
string
Giact response code
data.status
boolean
Result of ACH verification
{
"data": {}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"data": {
"accountResponseCode": "_5555",
"status": true
}
}{
"error": {
"statusCode": 400,
"code": "",
"message": "\"accountNumber\" is required",
"data": {}
}
}You may need to provide specific headers.
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
The endpoint path expects parameters.
transactionId
string
The transaction ID provided at lease generation.
You must provide a JSON payload.
items
array
The list of items to be cancelled.
items[].sku
string
Item's sku
items[].quantity
number
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
data.canceled
array
N/A
data.canceled[].sku
string
You may need to provide specific headers.
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
The endpoint path expects parameters.
transactionId
string
The transaction ID provided at lease generation.
You must provide a JSON payload.
items
array
The list of items to be confirmed.
items[].sku
string
Item's sku
items[].quantity
number
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
You may need to provide specific headers.
customer-token
string
Customer's authentication token
x-version-override
string
N/A
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
[
{
"id": "682634e9fbae50001bc06f77",
"referenceId": "D5ACE9023025",
"pastDue": 4500,
"leaseStartDate": "2025-05-22T21:50:58.175Z",
The response's schema is outlined below.
data
array
N/A
data[].id
string
The agreement id
data[].referenceId
string
You must provide a JSON payload.
string
user email
address
object
N/A
address.street1
string
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
data.addressExists
boolean
N/A
data.emailExists
boolean
Returns the details of a lease
GET /v3/leases/{leaseId}
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The endpoint path expects parameters.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
Collect a payment for an agreement
POST /v3/customers/me/agreements/{agreementId}/transactions/payment
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The endpoint path expects parameters.
You must provide a JSON payload.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
Signs a lease agreement
POST /v3/leases/{leaseId}/sign
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The endpoint path expects parameters.
You must provide a JSON payload.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
Cancels an item from a lease
POST /v3/transactions/{transactionId}/return
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The endpoint path expects parameters.
You must provide a JSON payload.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
{
"data": {
"canceled": [
{
"sku": "123ASD",
"quantity": 1
}
],
"failed": [
{
"sku": "123ASD",
"quantity": 1
}
]
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"data": {}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"data": {}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}Quantity, defaults to the number ordered if not present.
The Item's SKU canceled
data.canceled[].quantity
number
The quantity of items canceled
data.failed
array
N/A
data.failed[].sku
string
The Item's SKU failed to cancel
data.failed[].quantity
number
The quantity of items failed
Quantity, defaults to the number ordered if not present.
items[].receiptDate
string
The date picked up by the customer
Agreement reference id
data[].pastDue
number
Past due amount in cents. 0 if not past due.
data[].leaseStartDate
date
The lease start date, based on the first billing date.
data[].estimatedOwnership
number
Estimated amount required to own the item. Defaults to 0 if payoff data is not available.
data[].earlyPayoff
number
Total amount required to pay off the agreement early.
data[].items
array
List of items in this agreement
data[].items[].description
string
Description of the item
data[].items[].trackingCarrierName
string
Name of the shipping carrier for this item
data[].items[].trackingNumber
string
Tracking number assigned by the carrier
data[].items[].trackingStatus
string
Current tracking status of the item.
The first line of the address
address.street2
string
The second line of the address
address.city
string
The city of the address
address.region
string
The ISO 3166-2 state/province code of the address
address.postalCode
string
The postal code of the address
address.country
string
The ISO 3166-2 / 3166-3 country code of the address
phone
phone
user phone
N/A
data.phoneExists
boolean
N/A
data.leaseStatus
string
N/A
data.frequency
string
Frequency of lease payments
data.term
number
Term of the lease
data.payment
number
Periodic payment with tax
data.cashPrice
number
Cash price of the lease
data.costOfRental
number
Cost of the lease
data.isExpired
boolean
Whether the lease has expired
customer-token
string
Customer's authentication token
x-version-override
string
N/A
leaseId
string
Lease agreement identifier
data
object
N/A
data.leaseId
string
A unique identifier for the generated lease
data.contract
string
The lease contract, expressed as base64-encoded HTML
data[].outcome
string
Outcome
data[].failureReason
string
Failure Reason
data[].failureCode
string
Failure Code
customer-token
string
Customer's authentication token
x-version-override
string
N/A
agreementId
string
Agreement Id
paymentMethodId
string
Payment Method Id
amount
number
Amount
data
array
N/A
data[].paymentId
string
Payment ID
data[].amount
number
Amount
customer-token
string
Customer's authentication token
x-version-override
string
N/A
leaseId
string
Lease agreement identifier
ipAddress
string
The IP address of the device that was used to sign the lease.
timestamp
string
The date and time of the lease's signing.
signed
boolean
data
object
N/A
The signed status of the lease. Should be true
data.returned[].quantity
number
The quantity of items canceled
data.failed
array
N/A
data.failed[].sku
string
The Item's SKU failed to cancel
data.failed[].quantity
number
The quantity of items failed
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
transactionId
string
The transaction ID provided at lease generation.
items
array
The list of items to be cancelled.
items[].sku
string
Item's sku
items[].quantity
number
data
object
N/A
data.returned
array
N/A
data.returned[].sku
string
Quantity, defaults to the number ordered if not present.
The Item's SKU canceled
{
"data": {
"leaseId": "\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1YTk...",
"contract": "...base64 html contract",
"leaseStatus": "signed",
"frequency": "weekly",
"term": 52,
"payment": 17.28,
"cashPrice": 400,
"costOfRental": 440,
"isExpired": false
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 404,
"code": "LeaseNotFound",
"message": "The lease requested was not found",
"data": {}
}
}[
{
"paymentId": "682799b08737e7663dc31f32",
"amount": 2,
"failureReason": "DECLINE CHECK CHECK LIMIT EXCEEDED",
"failureCode": "123"
}
]{
"data": {}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 402,
"code": "PaymentRequired",
"message": "User user must make a payment to access a requested resource",
"data": {}
}
}{
"error": {
"statusCode": 404,
"code": "LeaseNotFound",
"message": "The lease requested was not found",
"data": {}
}
}{
"error": {
"statusCode": 410,
"code": "LeaseExpired",
"message": "The lease expired. Please create a new lease.",
"data": {}
}
}{
"data": {
"returned": [
{
"sku": "123ASD",
"quantity": 1
}
],
"failed": [
{
"sku": "123ASD",
"quantity": 1
}
]
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}You may need to provide specific headers.
customer-token
string
Customer's authentication token
x-version-override
string
N/A
You must provide a JSON payload.
primary
boolean
N/A
label
string
N/A
ach
object
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
Get transactions for a merchant.
GET /v3/transactions
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
You may provide query parameters to filter the output.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
Get logged user details
GET /v3/users/me
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
The Payment Plugin is an iframe, embeddable in your own site, that enables the user to sign-up or sign-in, apply for a spending limit, enter payment method(s), submit their First Payment, and sign the
{
"data": {}
}{
"error": {
"statusCode": 400,
"code": 11503,
"message": "Payment method is not primary eligible",
"data": {}
}
}{
"error": {
"statusCode": 400,
"code": 11505,
"message": "Bank is not accepted",
"data": {}
}
}{
"error": {
"statusCode": 400,
"code": 11506,
"message": "Bank requires verification",
"data": {}
}
}N/A
ach.routing
string
N/A
ach.account
string
N/A
ach.accountType
string
N/A
token
object
N/A
token.expirationDate
string
N/A
token.cardType
string
N/A
token.lastFour
string
N/A
token.firstSix
string
N/A
token.token
alternatives
N/A
token.billingZip
string
N/A
fromDate
date
Start date to retrieve
toDate
date
End date to retrieve
data.transactions[].orderId
string
The reference to the external order ID
data.transactions[].customer
object
N/A
data.transactions[].customer.id
string
User id
data.transactions[].customer.firstName
string
First Name
data.transactions[].customer.lastName
string
Last Name
data.transactions[].customer.email
string
Last Name
data.transactions[].shippingCost
number
shipping cost number
data.transactions[].createdAt
string
transaction creation date
data.transactions[].lease
object
N/A
data.transactions[].lease.id
string
order identifier
data.transactions[].lease.status
string
Signing status of the transaction
data.transactions[].items
array
N/A
data.transactions[].items[].description
string
item description
data.transactions[].items[].sku
string
item sku number
data.transactions[].items[].brand
string
item brand
data.transactions[].items[].cost
number
item cost
data.transactions[].items[].quantity
number
item quantity
data.transactions[].items[].quantityByStatus
object
Items quantity grouped by status
data.transactions[].purchaseTotal
number
total purchase cost in cents
data.transactions[].purchaseSalesTax
number
total sale tax in cents
data.meta
object
N/A
data.meta.count
number
N/A
data.meta.totalPages
number
N/A
data.meta.page
number
N/A
data.meta.limit
number
N/A
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
page
number
Page number to retrieve. Max 1000
limit
number
Limit of transactions to retrieve. Max 1000
leaseStatus
string
data
object
N/A
data.transactions
array
N/A
data.transactions[].id
string
Filter by lease status (signed/pending)
transaction identifier
data.lastName
string
User's last name
data.email
string
User's last name
data.createdAt
string
User's creation date
data.transactions
array
N/A
data.transactions[].id
string
Transaction Id
data.transactions[].createdAt
string
Transaction's creation date
data.transactions[].lease
object
N/A
data.transactions[].lease.id
string
lease identifier
data.transactions[].lease.status
string
N/A
data.decision
object
N/A
data.decision.applicationId
string
Application Id
data.decision.prequalId
string
prequalification ID
data.decision.approved
boolean
Determines if the customer was approved or not(To be deprecated)
data.decision.status
string
Determines the customer application status. Possible values: approved, pending, failed
data.decision.spendingLimit
number
The spending limit approved
data.decision.availableBalance
number
Available balance to spend
data.decision.availableWeeklySpending
number
The available amount to spend in a weekly basis
data.decision.createdAt
string
Decision's creation date
data.decision.waterfallSuppressionFlags
object
N/A
data.decision.waterfallSuppressionFlags.suppressWaterfallToUOwn
boolean
Determines if uown needs to be skipped)
data.decision.vantageHighScore
boolean
N/A
data.decision.funnel
string
N/A
data.verificationStatus
string
Verification status the possible status are: pending, failed, succeeded
data.dateOfBirth
string
User's date of birth
data.spendingHold
boolean
Determines if the customer spending was hold or not
customer-token
string
Customer's authentication token
x-version-override
string
N/A
data
object
N/A
data.userId
string
User Id
data.firstName
string
{
"data": {
"userId": "1234-asdf-4321-fdsa",
"firstName": "John",
"lastName": "Doe",
"email": "Doe",
"createdAt": "2018-03-19T15:51:27.080Z",
"transactions": [
{
"id": "asdf-1234-fdsa-4321",
"createdAt": "2018-12-21",
"lease": {
"id": "eyJhbGcfasdvczOiJIUzI1NiIsInR5cCI6IkpXVC...",
"status": "signed"
}
}
],
"decision": {
"applicationId": "d363955e-3110-11e8-a373-5e7783c1a76e",
"prequalId": "5a319511a86980001d602095",
"approved": true,
"status": "approved",
"spendingLimit": 1300,
"availableBalance": 1200,
"availableWeeklySpending": 120,
"createdAt": "2018-03-19T15:51:27.080Z",
"waterfallSuppressionFlags": {
"suppressWaterfallToUOwn": false
},
"vantageHighScore": true,
"funnel": "tireagent"
},
"verificationStatus": "succeeded",
"dateOfBirth": "1990-10-10",
"spendingHold": false
}
}User's first name
To create a lease, the createOrder method must be implemented. It will be called when the customer clicks on the FlexPay Payments button; once called, createOrder:
Makes use of actions.transaction.create() to create a valid order.
Launches the FlexShopper Payment modal where the customer may apply, get a spending limit, and sign the lease for their cart. Upon receiving a spending limit, customers are also given the chance to return to the store and add more items to their cart.
Once the consumer has signed their lease, the onSign method will be called. In this method you are required to:
Retrieve the order from FlexShopper's system and validate the signed agreement.
Finalize the order, confirming the lease's total value and items, as well as confirming that the shipping process is underway.
If these steps are not followed, orders may not be fulfilled or billed correctly. You will have to implement an endpoint that your customers can interact with that consumes our Backend API:
The data object will have the following shape:
Make sure to replace API_KEY with your organization's assigned API key. Note that API keys and authorization keys are separate.
Once FlexShopper receives confirmation that the consumer has received their item (delivery confirmation), your organization will be paid for the value of the lease. Use the Confirm Shipment API endpoint to inform FlexShopper of the shipment's status:
Once you've confirmed shipment, you're done. That's all there is to it!
{
"data": {
"transactions": [
{
"id": "eyJhbGcfasdvczOiJIUzI1NiIsInR5cCI6IkpXVC...",
"orderId": "2f962a52-df63-426f-abc7-617055dba2f7",
"customer": {
"id": "5a319511a86980001d602095",
"firstName": "John",
"lastName": "Doe",
"email": "[email protected]"
},
"shippingCost": 1.23,
"createdAt": "2018-03-19T15:51:27.080Z",
"lease": {
"id": "eyJhbGcfasdvczOiJIUzI1NiIsInR5cCI6IkpXVC...",
"status": "signed"
},
"items": [
{
"description": "iPad Mini",
"sku": "abc123",
"brand": "Apple",
"cost": 100.23,
"quantity": 1,
"quantityByStatus": {
"ordered": 1,
"shipped": 1
}
}
],
"purchaseTotal": 3795,
"purchaseSalesTax": 808
}
],
"meta": {
"count": 1,
"totalPages": 1,
"page": 1,
"limit": 20
}
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}const axios = require('axios');
// helper method holding business logic to validate order
const checkOrder = require('utils/check-order.js');
const flexShopperClient = axios.create({
baseURL: '/v3',
headers: {
Authorization: 'YOUR_API_KEY'
}
});
export const validateOrderHandler = async (req, res) => {
const transactionId = req.body.transactionId;
const transaction = await flexShopperClient.get(`/transactions/${transactionId}`)
const orderStatus = await checkOrder(transaction)
if (!orderStatus.isValid) {
res.json({valid: false, errors: orderStatus.errors});
return res.send(400);
}
await flexShopperClient.post(`/transactions/${transactionId}/finalize`)
res.json({valid: true});
res.send(200);
};use GuzzleHttp\Client;
use Psr\Http\Message\ServerRequestInterface;
use Psr\Http\Message\ResponseInterface;
use Zend\Diactoros\Response\JsonResponse;
$app->post('/validate-order', function (ServerRequestInterface $request): ResponseInterface {
$flexShopperClient = new Client([
'base_uri' => '/v3',
'headers' => [
'Authorization' => 'YOUR_API_KEY'
]
]);
$transactionId = $request->getParsedBody()['transactionId'];
$transaction = json_decode($flexShopperClient->get("/transactions/${transactionId}")->getBody());
$orderStatus = $checkOrder($transaction);
if (!$orderStatus->isValid) {
return new JsonResponse(['valid' => false, 'errors' => $orderStatus->errors], 400);
}
$flexShopperClient->post("/transactions/${transactionId}/finalize");
return new JsonResponse(['valid' => true, 'parsed_body' => $transactionId]);
});
from flask import Flask
from flask import jsonify
from flask import request
from requests_toolbelt import sessions
app = Flask(__name__)
flexshopper_client = sessions.BaseUrlSession(base_url='/v3')
flexshopper_client.headers.update({'Authorization': 'YOUR_API_KEY'})
@app.route('/validate-order', methods=['POST'])
def validate_order():
data = request.get_json()
transaction_id = data['transactionId']
transaction = flexshopper_client.get('/transaction/%s' % transaction_id)
order_status = check_order(transaction)
if not order_status['valid']:
return jsonify({'valid': False, 'errors': order_status['errors']}), 400, {'ContentType': 'application/json'}
flexshopper_client.post('/transaction/%s/finalize' % transaction_id)
return jsonify({'valid': True}), 200
<script src="https://pp3.flexshopper.com/sdk/js?authKey=AUTH_KEY"></script>
<script>
FlexSDK.Button({
createOrder: function() {}
onSign: function() {}
}).render('#elementSelector');
</script>FlexSDK.Button({
createOrder: function(data, actions) {
return actions.transaction.create({
cost: 120.34,
transactionId: "ABC-129384",
items: [
{
description: "Macbook Pro 13",
sku: "ABC123",
cost: 120.34,
brand: "Apple",
condition: "new",
quantity: 1,
images: [ // optional
"https://images.dog.ceo/breeds/husky/n02110185_11635.jpg"
],
shipping: {
cost: 10.33,
date: new Date(),
method: "UPS"
}
}
]
});
}
}).render('#elementSelector');FlexSDK.Button({
onSign: function(data) {
return fetch('/validate-order', {
method: 'POST',
body: JSON.stringify(data)
})
}
}).render('#elementSelector');{
"leaseNumber": "1234567",
"transactionId": "ABC-129384"
}You may need to provide specific headers.
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
The endpoint path expects parameters.
transactionId
string
The transaction ID provided at lease generation.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
{
"data": {
"id": "eyJhbGcfasdvczOiJIUzI1NiIsInR5cCI6IkpXVC...",
"orderId": "2f962a52-df63-426f-abc7-617055dba2f7",
"customer": {
"id": "5a319511a86980001d602095",
The response's schema is outlined below.
data
object
N/A
data.id
string
transaction identifier
data.orderId
string
You may need to provide specific headers.
customer-token
string
Customer's authentication token
x-version-override
string
N/A
x-consumer-custom-id
string
You may provide query parameters to filter the output.
asPdf
boolean
Flag to determine if contract will be in PDF format
sendLink
boolean
Flag to determine if a link will be sent
withToken
boolean
You must provide a JSON payload.
transactionId
string
A transaction ID to uniquely identify this transaction
orderId
string
The reference to the external order ID
items
array
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
data.leaseId
string
A unique identifier for the generated lease
data.contract
string
{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 404,
"code": "LeaseNotFound",
"message": "The lease requested was not found",
"data": {}
}
}{
"data": {
"leaseId": "\"eyJhbGciOiJIUzI1NiIsInR5cCI6IkpXVCJ9.eyJ1c2VySWQiOiI1YTk...",
"contract": "...base64 html contract",
"frequency": "weekly",
"term": 52,
"payment": 17.28,
"cashPrice": 400,
"costOfRental": 440,
"payTomorrowTaxTotal": 12.34
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}The reference to the external order ID
data.customer
object
N/A
data.customer.id
string
User id
data.customer.firstName
string
First Name
data.customer.lastName
string
Last Name
data.customer.email
string
Last Name
data.shippingCost
number
shipping cost number
data.createdAt
string
transaction creation date
data.lease
object
N/A
data.lease.id
string
order identifier
data.lease.status
string
N/A
data.items
array
N/A
data.items[].description
string
item description
data.items[].sku
string
item sku number
data.items[].brand
string
item brand
data.items[].cost
number
item cost
data.items[].quantity
number
item quantity
data.items[].quantityByStatus
object
Items quantity grouped by status
data.purchaseTotal
number
total purchase cost in cents
data.purchaseSalesTax
number
total sale tax in cents
Consumer data with the format "channel:vendorId"
Flag to determine if an agreement token will be returned
N/A
items[].brand
string
The item's brand.
items[].sku
string
The item's SKU (can be vendor-specific).
items[].productId
string
Product Id
items[].description
string
The item's description
items[].cost
number
The item's cost.
items[].condition
string
The item's condition
items[].quantity
number
The quantity of this item to add to the lease.
items[].mpn
string
The item's Manufacturer Part Number.
items[].gtin
string
The item's Global Trade Item Number.
shipping
object
N/A
shipping.cost
number
The shipping and handling fee, if any.
shipping.date
string
The shipping date, if any.
shipping.method
string
The shipping method
shipping.store
any
N/A
payTomorrowTaxTotal
number
The total tax amount send over by PayTomorrow
totalDiscount
number
The total discount amount to be applied proportionally across items
The lease contract, expressed as base64-encoded HTML
data.frequency
string
Frequency of lease payments
data.term
number
Term of the lease
data.payment
number
Periodic payment with tax
data.cashPrice
number
Cash price of the lease
data.costOfRental
number
Cost of the lease
data.payTomorrowTaxTotal
number
The total tax amount send over by PayTomorrow
Get all users for a given vendor
GET /v3/users
The details below help you form your HTTP requests to this endpoint.
You may need to provide specific headers.
You may provide query parameters to filter the output.
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data.users[].firstName
string
User's first name
data.users[].lastName
string
User's last name
data.users[].email
string
User's last name
data.users[].createdAt
string
User's creation date
data.users[].transactions
array
N/A
data.users[].transactions[].id
string
Transaction Id
data.users[].transactions[].createdAt
string
Transaction's creation date
data.users[].transactions[].lease
object
N/A
data.users[].transactions[].lease.id
string
lease identifier
data.users[].transactions[].lease.status
string
N/A
data.users[].decision
object
N/A
data.users[].decision.applicationId
string
Application Id
data.users[].decision.prequalId
string
prequalification ID
data.users[].decision.approved
boolean
Determines if the customer was approved or not(To be deprecated)
data.users[].decision.status
string
Determines the customer application status. Possible values: approved, pending, failed
data.users[].decision.spendingLimit
number
The spending limit approved
data.users[].decision.availableBalance
number
Available balance to spend
data.users[].decision.availableWeeklySpending
number
The available amount to spend in a weekly basis
data.users[].decision.createdAt
string
Decision's creation date
data.users[].decision.waterfallSuppressionFlags
object
N/A
data.users[].decision.waterfallSuppressionFlags.suppressWaterfallToUOwn
boolean
Determines if uown needs to be skipped)
data.users[].decision.vantageHighScore
boolean
N/A
data.users[].decision.funnel
string
N/A
data.users[].verificationStatus
string
Verification status the possible status are: pending, failed, succeeded
data.meta
object
N/A
data.meta.count
number
N/A
data.meta.totalPages
number
N/A
data.meta.page
number
N/A
data.meta.limit
number
N/A
x-consumer-custom-id
string
Consumer data with the format "channel:vendorId"
page
number
Page number to retrieve. Max 1000
limit
number
Limit of users to retrieve. Max 1000
data
object
N/A
data.users
array
N/A
data.users[].userId
string
User Id
{
"data": {
"users": [
{
"userId": "1234-asdf-4321-fdsa",
"firstName": "John",
"lastName": "Doe",
"email": "Doe",
"createdAt": "2018-03-19T15:51:27.080Z",
"transactions": [
{
"id": "asdf-1234-fdsa-4321",
"createdAt": "2018-12-21",
"lease": {
"id": "eyJhbGcfasdvczOiJIUzI1NiIsInR5cCI6IkpXVC...",
"status": "signed"
}
}
],
"decision": {
"applicationId": "d363955e-3110-11e8-a373-5e7783c1a76e",
"prequalId": "5a319511a86980001d602095",
"approved": true,
"status": "approved",
"spendingLimit": 1300,
"availableBalance": 1200,
"availableWeeklySpending": 120,
"createdAt": "2018-03-19T15:51:27.080Z",
"waterfallSuppressionFlags": {
"suppressWaterfallToUOwn": false
},
"vantageHighScore": true,
"funnel": "tireagent"
},
"verificationStatus": "succeeded"
}
],
"meta": {
"count": 1,
"totalPages": 1,
"page": 1,
"limit": 20
}
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}You may need to provide specific headers.
customer-token
string
Customer's authentication token
x-version-override
string
N/A
x-consumer-custom-id
string
You must provide a JSON payload.
driversLicenseNumber
string
Driver Licence Number
driversLicenseState
string
Driver License State
gender
string
The details below help you understand the responses you could get from this endpoint.
Below are samples of responses, with tabs corresponding to returned status code.
The response's schema is outlined below.
data
object
N/A
data.userId
string
User Id
data.firstName
string
{
"data": {
"userId": "1234-asdf-4321-fdsa",
"firstName": "John",
"lastName": "Doe",
"email": "Doe",
"createdAt": "2018-03-19T15:51:27.080Z",
"transactions": [
{
"id": "asdf-1234-fdsa-4321",
"createdAt": "2018-12-21",
"lease": {
"id": "eyJhbGcfasdvczOiJIUzI1NiIsInR5cCI6IkpXVC...",
"status": "signed"
}
}
],
"decision": {
"applicationId": "d363955e-3110-11e8-a373-5e7783c1a76e",
"prequalId": "5a319511a86980001d602095",
"approved": true,
"status": "approved",
"spendingLimit": 1300,
"availableBalance": 1200,
"availableWeeklySpending": 120,
"createdAt": "2018-03-19T15:51:27.080Z",
"waterfallSuppressionFlags": {
"suppressWaterfallToUOwn": false
},
"vantageHighScore": true,
"funnel": "tireagent"
},
"verificationStatus": "succeeded"
}
}{
"error": {
"statusCode": 400,
"code": "UserAlreadyExists",
"message": "User already exists with email [email protected]",
"data": {}
}
}{
"error": {
"statusCode": 404,
"code": "LeaseNotFound",
"message": "The lease requested was not found",
"data": {}
}
}{
"error": {
"statusCode": 409,
"code": "UserAlreadyExists",
"message": "The user already exists",
"data": {}
}
}{
"error": {
"statusCode": 502,
"code": "BadGateway",
"message": "Gateway returned status code",
"data": {}
}
}Consumer data with the format "channel:vendorId"
x-real-ip
string
senders ip address
customer-ip
string
customer ip address
Gender
street1
string
The first line of the address
street2
string
The second line of the address
city
string
The city of the address
regionAbbr
string
The ISO 3166-2 state/province code of the address
postalCode
string
The postal code of the address
country
string
The ISO 3166-1 alpha-2 country code of the address
mobilePhone
phone
The mobile phone number of the customer
dateOfBirth
string
Date of Birth of the customer
ssn
string
Social Security Number of the customer
employmentInformation
object
N/A
employmentInformation.name
string
Name of Employer
employmentInformation.phone
phone
The work phone number of the customer
employmentInformation.monthlyIncome
number
Monthly income from employment before taxes are deducted (Dollar amount)
employmentInformation.payFrequency
string
Allowed values: weekly, biweekly, semimonthly, monthly, yearly, none
employmentInformation.lastPayDate
string
timestamp when last pay date
employmentInformation.nextPayDate
string
timestamp when next pay date
bankAccount
object
N/A
bankAccount.routing
string
Bank account routing number
bankAccount.account
string
Bank account number
bankAccount.type
string
Account type. Allowed values: checking, savings
fraudCheck
array
N/A
fraudCheck[].providerName
string
N/A
fraudCheck[].score
number
N/A
fraudCheck[].status
string
N/A
cardInformation
array
N/A
cardInformation[].type
string
N/A
cardInformation[].expirationDate
string
N/A
cardInformation[].lastFour
string
N/A
cardInformation[].firstSix
string
N/A
cardInformation[].cardType
string
N/A
cardInformation[].tokens
array
N/A
cardInformation[].tokens[].gateway
string
N/A
cardInformation[].tokens[].token
string
N/A
cardInformation[].validation
object
N/A
deviceFingerprint
string
Long base64-encoded string
expectedPurchaseAmount
number
Requested spending limit for customer purchase
optInMarketing
boolean
The customer's approval for opt-in into FlexShopper marketing and promotions
additionalData
object
N/A
additionalData.storeEmployeeId
string
Store Employee Id
additionalData.commonApplicationKey
object
Synchrony ID
additionalData.firstGlance
boolean
Determines if we are the first used in the cascade
User's first name
data.lastName
string
User's last name
data.email
string
User's last name
data.createdAt
string
User's creation date
data.transactions
array
N/A
data.transactions[].id
string
Transaction Id
data.transactions[].createdAt
string
Transaction's creation date
data.transactions[].lease
object
N/A
data.transactions[].lease.id
string
lease identifier
data.transactions[].lease.status
string
N/A
data.decision
object
N/A
data.decision.applicationId
string
Application Id
data.decision.prequalId
string
prequalification ID
data.decision.approved
boolean
Determines if the customer was approved or not(To be deprecated)
data.decision.status
string
Determines the customer application status. Possible values: approved, pending, failed
data.decision.spendingLimit
number
The spending limit approved
data.decision.availableBalance
number
Available balance to spend
data.decision.availableWeeklySpending
number
The available amount to spend in a weekly basis
data.decision.createdAt
string
Decision's creation date
data.decision.waterfallSuppressionFlags
object
N/A
data.decision.waterfallSuppressionFlags.suppressWaterfallToUOwn
boolean
Determines if uown needs to be skipped)
data.decision.vantageHighScore
boolean
N/A
data.decision.funnel
string
N/A
data.verificationStatus
string
Verification status the possible status are: pending, failed, succeeded