Quickstart
Create your first financing application in staging in about 10 minutes.
This guide takes you from credentials to a completed test application. You'll authenticate, create an order, walk through the application as a customer, and handle the postback.
What you need
Your staging API username, password, and API Signature from Resources in the merchant dashboard. If you don't have them yet, ask your PayTomorrow account manager.
Get an access token
Send your API username and password with your API Signature in the Authorization header. The API Signature is already base64 encoded, so use it as is.
curl -X POST https://api-staging.paytomorrow.com/api/uaa/oauth/token \
-H "Authorization: Basic $PT_API_SIGNATURE" \
-H "Accept: application/json" \
-H "Content-Type: application/x-www-form-urlencoded" \
--data-urlencode "grant_type=password" \
--data-urlencode "scope=openid" \
--data-urlencode "username=$PT_USERNAME" \
--data-urlencode "password=$PT_PASSWORD"The response contains an access_token. Cache it and reuse it until expires_in seconds have passed.
Create an order
Send the cart and customer details. Use your own order ID so you can match postbacks to orders later.
curl -X POST https://api-staging.paytomorrow.com/api/application/ecommerce/orders \
-H "Authorization: Bearer $PT_ACCESS_TOKEN" \
-H "Content-Type: application/json" \
-d '{
"orderId": "100045",
"firstName": "Jordan",
"lastName": "Rivera650",
"street": "123 Main St",
"city": "Charlotte",
"state": "NC",
"zip": "28202",
"email": "jordan.rivera@example.com",
"cellPhone": "7045550123",
"returnUrl": "https://yourstore.com/checkout/paytomorrow/success",
"cancelUrl": "https://yourstore.com/checkout/paytomorrow/cancel",
"notifyUrl": "https://yourstore.com/webhooks/paytomorrow",
"loanAmount": 1149.97,
"shipping": 49.99,
"taxes": 99.99,
"applicationItems": [
{ "description": "65-inch 4K Smart TV", "quantity": 1, "price": 999.99, "sku": "TV-AX65" }
]
}'You get back:
{
"url": "https://consumer-staging.paytomorrow.com/verify/personal?app=3f9c2a7e5b8d4e1fa0c6b2d9e7f41a53&auth=...",
"token": "3f9c2a7e5b8d4e1fa0c6b2d9e7f41a53"
}Save token with your order. Every other API call uses it, and postbacks send it back as uuid.
Check for a null token
If the cart total is outside your approval range or the shipping address is a PO box, token is null. The url then shows the customer why and links back to your cancelUrl. Treat it as a failed attempt and offer another payment method.
Apply as a test customer
Open the url in your browser. This is what your customer sees.
Make sure to follow these rules
Otherwise the application may be declined. The name, email, and mobile number come from your Create order request, so change them before each test.
- Use a new, random email address and mobile number every time. Staging doesn't send texts, so enter any verification code.
- Use any random first and last name, and end the last name with the credit score you want, like
Testing640. PayTomorrow's lender takes 600 to 700 and Katapult takes 100 to 600. For Bread, leave the number off. - Use a random address, SSN, date of birth over 18, and pay schedule.
- Card number
4444 3333 2222 1111, any future expiration date, and CVV123.
See Testing for all the test data.
The example above uses Rivera650, so the score is 650. Finish the application, choose an offer, and sign.
Handle the postback
When the application reaches Ready to Settle (S), PayTomorrow sends a form-encoded POST to your notifyUrl:
txn_type=cart&payment_status=pending&uuid=3f9c2a7e5b8d4e1fa0c6b2d9e7f41a53&pt_app_status=S&pt_ammount=1149.97&order_id=100045&...Persist the notification for reconciliation. Read Get application status with your access token and match your saved order details with Validate postback. Only prepare shipment when the authenticated current status is S and the details match. The inbound status and VERIFIED_PT alone do not authorize shipment. See safe postback processing.
Testing locally?
Use the postback builder to send realistic postbacks to your local server, or expose it with a tunnel like ngrok so staging can reach it.
Settle when you ship
After the order ships, settle the application so PayTomorrow can fund you:
curl -X POST "https://api-staging.paytomorrow.com/api/ecommerce/application/$PT_TOKEN/settle" \
-H "Authorization: Bearer $PT_ACCESS_TOKEN"You'll get one more postback with payment_status=completed when the application is funded (C).