Jetpay Developer Guide
Receive payments
Directly charge a credit card
7 min
to enable card on file features such as this one, you must contact mailto\ jetpay\@baselinepayments com directly charge a saved card with a single request from your backend this flow is designed for applications where users maintain an account and store payment methods for reuse a typical example is a logged in user selecting a saved card from a dropdown and completing payment without re entering card details if you need to collect card details at the time of payment , for example, guest checkout or one time payments, use the docid\ lnp1zgf7ybpwuvs3g5urf flow instead prerequisites docid zgmim7qkrraox9jjaqrl your docid\ aex0ssfndr xgalxg2 zf where funds will be deposited docid 5zw0fs71q4rn5ry5ifpj before you charge a saved card, the customer must exist as a contact in jetpay and have at least one tokenized payment method attached if you have not yet created a contact or collected card details, complete the docid\ bzwf0wyooqbkgsfugenh0 and docid 5zw0fs71q4rn5ry5ifpj guides first once a payment method is stored, you can charge it directly flow overview sequencediagram autonumber participant platform participant jetpay participant cardnetwork as card network platform >>jetpay post /contact/{contact id}/creditcards/{credit card id}/charge jetpay >>cardnetwork authorize & capture cardnetwork >>jetpay response (approved / declined) jetpay >>platform charge created (status paid) jetpay >>platform webhook (completed / failed) implementation details charge the contact credit card endpoint post /contact/{contact id}/creditcards/{credit card id}/charge https //extapi jetpay baselinepayments com/docs#tag/contacts (v0)/operation/charge contact credit card contact contact id creditcards credit card id charge post curl https //extapi demo jetpay baselinepayments com/contact/contact 123/creditcards/cc 456/charge \\ x post \\ h "authorization bearer \<your api token>" \\ h "content type application/json" \\ d '{ "amount" 100 50, "to bank account id" "\<your bank account id>", "statement" "test statement", "note" "test note" }'import requests url = "https //extapi demo jetpay baselinepayments com/contact/contact 123/creditcards/cc 456/charge" headers = { "authorization" "bearer \<your api token>", "content type" "application/json" } payload = { "amount" 100 50, "to bank account id" "\<your bank account id>", "statement" "test statement", "note" "test note" } response = requests post(url, json=payload, headers=headers) print(response status code) print(response json())const fetch = require("node fetch"); const url = "https //extapi demo jetpay baselinepayments com/contact/contact 123/creditcards/cc 456/charge"; const payload = { amount 100 50, to bank account id "\<your bank account id>", statement "test statement", note "test note" }; fetch(url, { method "post", headers { "authorization" "bearer \<your api token>", "content type" "application/json" }, body json stringify(payload) }) then(res => res json()) then(data => console log(data)) catch(err => console error(err)); handle the response if the card is successfully charged, a response will be returned with an http status code of 200 and the following response body { "debit id" "debit 123", "amount" 100 50, "statement" "test statement", "note" "test note", "to bank account id" "your bank account id", "contact id" "contact 123", "from credit card id" "cc 456", "transaction state" "paid" } you should store the returned debit id so that it can be cross referenced against the webhook events that we send final transaction outcomes (such as completed or failed ) are delivered via docid bnn6n5bf afner 9sddr track status updates via events/webhooks as the transaction moves through its lifecycle, an event is created for each state update the most efficient way to track these updates in your system is to register for webhooks if you are not yet familiar with our webhooks system, please review the docid 79a4cgvetacholkpjyd5c guide