Add to checkout
Integrate Venmo payments using Pay.com.js or the REST API.
You can accept Venmo payments in three ways:
- Universal checkout: Pay.com.js displays Venmo in its payment form.
- Headless checkout: You build your own checkout UI, and Pay.com.js starts the Venmo payment when the customer selects it.
- Server-to-server: You create the charge from your server and redirect the customer to Venmo.
Before you start, ask your account manager to enable Venmo for your account, then turn it on in the Pay.com dashboard.
Universal checkout
Universal checkout displays Venmo in its payment form when the payment session includes it.
- 1
Create a payment session
On your server, create a payment session with
POST /v1/sessions/paymentand include"venmo"inpayment_method_types.{ "amount": 5000, "currency": "usd", "customer_reference_id": "cust-001", "payment_method_types": ["card", "venmo"] }Amounts are in the currency's minor unit, so
5000is $50.00.customer_reference_idis your own ID for the customer, and it's required. Return the session'sclient_secretto your page. - 2
Display the checkout
On your page, initialize Pay.com.js with the
client_secretand mount Universal checkout, as in Universal checkout. No method-specific configuration is required. - 3
Handle the result
When the customer selects Venmo and clicks Pay, Pay.com.js opens Venmo in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome.
When the customer finishes, Pay.com.js calls
onSuccessif the payment succeeded,onPendingif its result isn't final yet, oronFailureif it failed. Fulfill the order when you receive thecharge.succeededwebhook event.
Headless checkout
With Headless checkout, you build your own checkout UI, and Pay.com.js starts the Venmo payment when the customer selects it.
- 1
Create a payment session
Create the payment session on your server as in Universal checkout, with
"venmo"inpayment_method_types, and initialize Pay.com.js with itsclient_secret. - 2
Check that Venmo is available
Call
checkout.getPaymentMethods(), and show your Venmo button only when the list includes it. Don't usecheckout.canMakePayments()for this, because it reports only Apple Pay and Google Pay.const methods = await checkout.getPaymentMethods() const venmo = methods.find((method) => method.paymentMethodType === 'venmo') - 3
Start the payment
When the customer selects Venmo, call
checkout.headless()with'venmo'.try { await checkout.headless('venmo') } catch (error) { // onFailure receives the error details too. }Pay.com.js opens Venmo in a new tab. Meanwhile, your page asks the customer to finish there. If they close the tab, Pay.com.js keeps waiting for the payment's outcome.
When the customer finishes, Pay.com.js calls
onSuccessif the payment succeeded,onPendingif its result isn't final yet, oronFailureif it failed. Fulfill the order when you receive thecharge.succeededwebhook event.
Server-to-server
From your server, a Venmo payment takes three steps: create the charge, create a linked authentication session to obtain the redirect URL, and redirect the customer to Venmo.
- 1
Create the charge
Send
POST /v1/chargeswithsource_data.typeset to"venmo". Pay.com passessource_data.billing_detailsto Venmo to prefill its page for the customer.{ "amount": 5000, "currency": "usd", "source_data": { "type": "venmo", "billing_details": { "name": "Jane Smith", "email": "jane.smith@example.com", "address": { "country": "US" } } }, "customer_reference_id": "cust-001", "reference": "order-12345", "description": "Order #12345" }{ "id": "chrg_702172227948251136", "resource": "charge", "amount": 5000, "currency": "usd", "status": "requires_authentication", "payment_method_details": { "type": "venmo" }, "reference": "order-12345", "test_mode": true }The charge's
statusisrequires_authenticationuntil the customer approves the payment. - 2
Create a linked authentication session
Send
POST /v1/sessions/authentication/linkedwith the charge'sidasresourceand thereturn_urlto return the customer to.confirmdefaults totrue, so Pay.com completes the charge when the customer approves it. Each charge supports one linked authentication session.{ "resource": "chrg_702172227948251136", "return_url": "https://your-site.com/payment/complete" }{ "id": "sca_702172392511768576", "resource": "authentication_session", "status": "open", "return_url": "https://your-site.com/payment/complete", "url": "https://alternatives.sandbox.pay.com/authenticate?client_secret=...", "test_mode": true } - 3
Redirect the customer
Send the customer to the session's
urlwith a full-page redirect. After they approve or cancel the payment, Venmo redirects them back to yourreturn_url. Fulfill the order when you receive thecharge.succeededwebhook event, and handlecharge.failedas a canceled or declined payment.
Test in the sandbox
Test with your sandbox API key (sk-pay-com-sandbox-...) against https://api.sandbox.pay.com/v1. Sandbox payments never move real funds. See Environments.
In the sandbox, you can verify each step up to the redirect to Venmo's page.
| Step | Expected result |
|---|---|
| Create a charge | POST /v1/charges with source_data.type set to "venmo" returns status: "requires_authentication". |
| Get the redirect URL | POST /v1/sessions/authentication/linked with the charge's id returns a url. |
| Reach Venmo | Opening the url in a browser loads Venmo's page with the payment's amount. |
| Display Venmo in Universal checkout | A payment session with "venmo" in payment_method_types displays Venmo in the form. |
| Find Venmo with Headless checkout | checkout.getPaymentMethods() returns an entry with paymentMethodType: "venmo". |