Online card payments are a beta feature. Contact Vori Support to enroll.
Before you begin
You need:- A Vori API key with access to the store and payments.
- The store ID.
- An e-commerce merchant account for live payments. Contact Vori Support if the store does not have one.
- A public tokenization key from the store’s
ecommerce_credentialsproperty.
mode: "test" while developing. Test payments move no money. Switch both tokenization and API requests to mode: "live" only after the store’s live e-commerce merchant account is ready.
Get the store’s public key
Retrieve the store:live credential is absent until the store has an e-commerce merchant account. A test credential can be used only with test tokenization and mode: "test" API requests.
Tokenize the card in the browser
Load the Datacap JavaScript client that matches the payment mode:- Live:
https://token.dcap.com/v1/client - Test:
https://token-cert.dcap.com/v1/client
data-token attributes to the card inputs. Pass the store’s matching public key, the form ID, and a callback to DatacapWebToken.requestToken.
Create the payment
Your server sends the token toPOST /v1/payments:
amount is in dollars and must be between 0.01 and 99999.99.
Create a unique idempotency_key for each intended charge. If the request times out or its result is unclear, retry the same request with the same key and token. While the processor is still working, a retry can return HTTP 409 Conflict with error_code: "payment_in_progress" and the payment ID in error_details.payment_id. Continue retrying with the same key and token until Vori returns the captured payment or a definitive decline. Do not treat the first retry as the final outcome.
A successful response includes the payment ID, status, payment mode, processor, and card details that are safe to display:
id with your order. You need it to retrieve or refund the payment.
A gateway timeout does not prove the card was not charged. Retry with the same
idempotency_key and token. Do not create a new key unless Vori confirms the original payment was declined.Handle payment results
captured: The charge succeeded.failed: The processor declined the charge. This status appears when you retrieve the payment, not in the create response.
POST /v1/payments request returns HTTP 402 Payment Required with error_code: "card_declined". The error_details.payment_id property identifies the payment, and error_details.processor_message contains the processor’s explanation when available:
error_details.payment_id, the payment response has status: "failed".
Ask the shopper for another payment method and tokenize it again. A new charge requires a new token and a new idempotency key.
Retrieve a payment at any time:
Refund a payment
Create a full or partial refund withPOST /v1/refunds:
void: Cancels a full charge before it settles, when the processor still permits it.return: Sends money back to the card. Partial refunds always use this type.
Go live safely
1
Confirm the live credential
Retrieve the store and verify
ecommerce_credentials contains a live public key. If it is missing, contact Vori Support.2
Load the production tokenizer
Change the Datacap script URL to
https://token.dcap.com/v1/client and use the store’s live public key.3
Use live mode on the server
Send
mode: "live" for payments and refunds. Never mix a test token or credential with a live API request.4
Verify one controlled payment
Run a small live charge, confirm its
captured status, and refund it before opening checkout to shoppers.