Raw card numbers are never sent to or stored by Nymble Commerce. All card data is submitted directly from your customer’s browser to the payment provider’s hosted page. Nymble Commerce receives only a token and masked card details after the transaction is complete.
Hosted payment flow
The standard card payment flow uses a provider-hosted page so that your application never handles raw card data.1
Initiate a transaction setup
Call
POST /api/payments/worldpay/transaction-setup with the customer number, the invoice amount, and a return URL. Nymble Commerce creates a transaction setup with the payment provider and returns a HostedPaymentUrl and a TransactionSetupId.2
Redirect the customer
Redirect the customer’s browser to the
HostedPaymentUrl. The payment provider renders a secure, hosted payment form where the customer enters their card details.3
Customer submits payment
The customer completes the payment form on the provider’s hosted page. The provider processes the transaction directly.
4
Provider posts the callback
After the transaction completes (success or failure), the provider posts the result to Nymble Commerce’s callback endpoint (
POST /api/payments/worldpay/callback). Nymble Commerce records the payment against the invoice and updates the invoice status accordingly.5
Customer is redirected back
The provider redirects the customer to the
ApplicationReturnUrl you supplied in step 1. You can use this URL to display a payment confirmation or error message in your application.Saved payment methods
You can save a customer’s card as a payment method (card-on-file) to enable one-click checkout and recurring billing. Nymble Commerce stores only the payment provider’s token and masked card details — never the raw card number.- For Authorize.Net: you can save a card directly by posting card details to
POST /api/payments/payment-methods. Authorize.Net tokenizes the card and returns aPaymentProfileId. - For WorldPay: saving a card requires a redirect to a hosted page.
POST /api/payments/payment-methodsreturns aRequiresRedirect: trueresponse with aRedirectUrl. Send the customer to that URL to complete tokenization.
The payment method object
string
Internal Nymble Commerce ID for this saved payment method.
string
The customer account this payment method belongs to.
string
The payment provider’s identifier for this saved card profile. Use this ID when recording payments against an invoice.
string
The payment provider’s identifier for the customer profile that owns this payment method.
string
The masked card number (e.g.
XXXX1234).string
Card brand (e.g.
Visa, Mastercard, AmericanExpress, Discover).string
Card expiry in
MMYY or MM/YYYY format, as returned by the provider.integer
Expiry month as an integer (1–12).
integer
Expiry year as a four-digit integer.
object
The billing address associated with this card.
boolean
Whether this is the customer’s default payment method.
string
The payment provider that issued this profile token (e.g.
AuthorizeNet, WorldPay).boolean
Whether this payment method is active.
string
Network transaction ID from the provider, used for subsequent card-on-file transactions.
Endpoints
Initiate a hosted payment session
Creates a WorldPay transaction setup and returns a URL to which you redirect the customer to complete payment. This is the first step in the hosted payment flow.Request body
string
required
The account number of the customer making the payment. Used to associate the transaction and any saved card with the correct customer profile.
number
required
The amount to charge. Pass
0.00 if you are using this setup only to save a payment method without charging the customer.string
required
The URL in your application to redirect the customer to after payment completes (whether successful or failed). The provider appends the transaction result as query parameters.
string
WorldPay market code. Defaults to
Default. Contact your Nymble Commerce account team if you need a custom market code.boolean
If the customer saves their card during this transaction, whether to set it as their default payment method. Defaults to
false.Example request
Response
string
The transaction setup ID from the payment provider. Valid for 10 minutes. Store this to correlate the provider callback with the payment attempt.
string
The complete URL to redirect the customer to. This URL contains the setup ID and provider-specific parameters — do not modify it.
Example response
hostedPaymentUrl:
Get saved payment methods for a customer
Retrieves all saved payment methods (cards on file) for a customer. Use the returnedpaymentProfileId values when recording a payment against an invoice via POST /api/invoices/{invoiceId}/payments.
Path parameters
string
required
The customer’s account number.
Example request
Response
Returns200 OK with an array of payment method objects.
Save a payment method
Saves a payment method (tokenizes a card) for a customer. The behaviour differs by payment provider:- Authorize.Net: card details are submitted directly in the request body. Authorize.Net tokenizes the card server-side and returns the saved payment method immediately.
RequiresRedirectisfalse. - WorldPay: a direct card submission is not supported. The response contains
RequiresRedirect: trueand aRedirectUrl. Redirect the customer to that URL to enter their card details on the WorldPay hosted page.
Request body
string
required
The account number of the customer whose card is being saved.
string
required
Customer’s email address, used to create or match the customer profile with the payment provider.
string
required
Full card number. Only used for Authorize.Net (direct flow). For WorldPay, any value is acceptable — the redirect flow ignores this field.
string
required
Two-digit expiry month (e.g.
09).string
required
Four-digit expiry year (e.g.
2027).string
required
Card security code (CVV/CVC). Required for Authorize.Net. Not stored after tokenization.
object
required
The billing address for the card.
boolean
Set to
true to make this the customer’s default payment method. Defaults to false.string
Specify which payment provider to use (
AuthorizeNet or WorldPay). When omitted, uses the organization’s default active provider.string
For WorldPay (redirect flow) — the URL in your application to return the customer to after they save their card. Defaults to
http://localhost:3000/payment-success when omitted.Example request (Authorize.Net — direct)
Example request (WorldPay — redirect)
Response
boolean
false for Authorize.Net (card saved immediately). true for WorldPay (customer must complete a hosted page).string
The URL to redirect the customer to (WorldPay only).
null for Authorize.Net.string
The payment provider used for this request.
object
The saved payment method (Authorize.Net only, when
requiresRedirect is false). See the payment method object for full field details.Example response (Authorize.Net — direct)
Example response (WorldPay — redirect)
requiresRedirect is true, redirect the customer’s browser to redirectUrl:
WorldPay payment callback
WorldPay posts to this endpoint after a hosted payment transaction completes (successfully or otherwise). Do not call this endpoint directly from your application — it is called by WorldPay’s payment infrastructure after every transaction initiated viaPOST /api/payments/worldpay/transaction-setup.
When Nymble Commerce receives a successful callback, it:
- Records the payment against the associated invoice.
- Updates the invoice status to
PartiallyPaidorPaid. - Saves the card as a payment method if the customer opted in during the hosted page flow.
Document this endpoint if you operate a proxy or firewall in front of the Nymble Commerce API. You must allow inbound
POST requests from WorldPay’s IP ranges to this path.What WorldPay sends
WorldPay posts a form-encoded payload containing theTransactionSetupID, approval code, card details, and transaction result. Nymble Commerce validates the payload against the original transaction setup and processes the result accordingly.
You do not need to handle or forward this callback — it is consumed entirely by Nymble Commerce. Your application is notified of the result via the ApplicationReturnUrl redirect you supplied when creating the transaction setup.