Validate and save a payment method
Check a tokenized method and create a vault record for future payments.
Prepare consent and credentials
Confirm Customer Vault access and the customer’s consent. Collect a token through the Payment Component; keep the merchant private key server-side.
Validate when required
This checks the payment method without creating a sale. Validation and saving are separate requests. POST /api/v5/payments/validate HTTP/1.1 Host: sandbox.nmi.com Authorization: <sandbox-private-merchant-key> Content-Type: application/json { "payment_details": { "payment_token": "<fresh-sandbox-token>" } }
Create the vault record
Supply a valid token for this operation. If a token was consumed or expired during validation, collect a fresh one before continuing. POST /api/v5/customers HTTP/1.1 Host: sandbox.nmi.com Authorization: <sandbox-private-merchant-key> Content-Type: application/json { "customer_id": "CUST-EXAMPLE-001", "billing": { "first_name": "Example", "last_name": "Customer", "payment_details": { "payment_token": "<valid-sandbox-token>" } } }
Confirm the saved result
Record the returned customer identifier under the right merchant. Verify the vault record before offering saved-method checkout. A saved method is not proof of a completed payment.