Jetpay Developer Guide
Receive payments
Preauthorize and capture
10 min
to enable card on file features such as this one, you must contact mailto\ jetpay\@baselinepayments com directly this flow allows you to authorize a saved card without immediately capturing funds it is designed for platforms that need to reserve funds and capture them later for example, rentals, deposits, usage based billing, or marketplaces confirming fulfillment if you want to immediately charge a saved card, see docid\ fqy5afjmmgj3h5ioyttfd instead jetpay currently only supports capturing the full amount of the preauthorized transaction partial capture is coming soon! 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 preauthorize 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}/preauthorize jetpay >>cardnetwork authorize only cardnetwork >>jetpay authorization result jetpay >>platform debit created (status preauthorized) platform >>jetpay post /debit/{debit id}/capture jetpay >>cardnetwork capture request cardnetwork >>jetpay capture result jetpay >>platform debit updated (status paid) jetpay >>platform webhook (paid / failed) implementation details create a preauthorization endpoint post /contact/{contact id}/creditcards/{credit card id}/preauthorize https //extapi jetpay baselinepayments com/docs#tag/contacts (v0)/operation/preauthorize contact credit card contact contact id creditcards credit card id preauthorize post curl https //extapi demo jetpay baselinepayments com/contact/contact 123/creditcards/cc 456/preauthorize \\ 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" }'import requests url = "https //extapi demo jetpay baselinepayments com/contact/contact 123/creditcards/cc 456/preauthorize" 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" } 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/preauthorize"; const payload = { amount 100 50, to bank account id "\<your bank account id>", statement "test statement" }; 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 preauthorized, 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", "to bank account id" "your bank account id", "contact id" "contact 123", "from credit card id" "cc 456", "transaction state" "preauthorized" } you must store the returned debit id so that it can be cross used to for the capture endpoint next capture the transaction endpoint post /debit/{debit id}/capture https //extapi jetpay baselinepayments com/docs#tag/transactions (v0)/operation/capture debit debit identifier capture post curl https //extapi demo jetpay baselinepayments com/debit/debit 123/capture \\ x post \\ h "authorization bearer \<your api token>"import requests url = "https //extapi demo jetpay baselinepayments com/debit/debit 123/capture" headers = { "authorization" "bearer \<your api token>" } response = requests post(url, headers=headers) print(response status code) print(response json())const fetch = require("node fetch"); const url = "https //extapi demo jetpay baselinepayments com/debit/debit 123/capture"; fetch(url, { method "post", headers { "authorization" "bearer \<your api token>" } }) then(res => res json()) then(data => console log(data)) catch(err => console error(err)); handle the response if the transaction is successfully captured, a response will be returned with an http status code of 200 the new state of the transaction will be paid { "identifier" "debit 123", "state" "paid" } 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