API reference
Sources
Source objects allow you to accept a variety of payment methods. They represent a customer's payment instrument, and can be used with the Stripe API just like a Card object: once chargeable, they can be charged, or can be attached to customers. Stripe doesn't recommend using the deprecated Sources API. We recommend that you adopt the PaymentMethods API. This newer API provides access to our latest features and payment method types. Related guides: Sources API and Sources & Customers.
https://api.knoxapi.comCreate a source
POST/v1/sources
Creates a new source object.
Body parameters
amountintegerAmount associated with the source. This is the amount for which the source will be chargeable once ready. Required for
single_usesources. Not supported forreceivertype sources, where charge amount may not be specified until funds land.currencystringThree-letter ISO code for the currency associated with the source. This is the currency for which the source will be chargeable once ready.
customerstringThe
Customerto whom the original source is attached to. Must be set when the original source is not aSource(e.g.,Card).expandarray of stringsSpecifies which fields in the response should be expanded.
flowstringThe authentication
flowof the source to create.flowis one ofredirect,receiver,code_verification,none. It is generally inferred unless a type supports multiple flows.Possible valuescode_verificationnonereceiverredirect
mandateobjectInformation about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
Show 5 child parameters
acceptanceobjectShow 7 child parameters
statusstringRequiredPossible valuesacceptedpendingrefusedrevoked
dateintegeripstringofflineobjectChild parameters are listed in the OpenAPI document.
onlineobjectChild parameters are listed in the OpenAPI document.
typestringPossible valuesofflineonline
user_agentstring
amountintegercurrencystringintervalstringPossible valuesone_timescheduledvariable
notification_methodstringPossible valuesdeprecated_noneemailmanualnonestripe_email
metadataobjectoriginal_sourcestringThe source to share.
ownerobjectInformation about the owner of the payment instrument that may be used or required by particular source types.
Show 4 child parameters
addressobjectShow 6 child parameters
citystringcountrystringline1stringline2stringpostal_codestringstatestring
emailstringnamestringphonestring
receiverobjectOptional parameters for the receiver flow. Can be set only if the source is a receiver (
flowisreceiver).Show 1 child parameter
refund_attributes_methodstringPossible valuesemailmanualnone
redirectobjectParameters required for the redirect flow. Required if the source is authenticated by a redirect (
flowisredirect).Show 1 child parameter
return_urlstringRequired
source_orderobjectInformation about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.
Show 2 child parameters
itemsarray of objectsShow 6 child parameters
amountintegercurrencystringdescriptionstringparentstringquantityintegertypestringPossible valuesdiscountshippingskutax
shippingobjectShow 5 child parameters
addressobjectRequiredChild parameters are listed in the OpenAPI document.
carrierstringnamestringphonestringtracking_numberstring
statement_descriptorstringAn arbitrary string to be displayed on your customer's statement. As an example, if your website is
RunCluband the item you're charging for is a race ticket, you may want to specify astatement_descriptorofRunClub 5K race ticket.While many payment types will display this information, some may not display it at all.tokenstringAn optional token used to create the source. When passed, token properties will override source parameters.
typestringThe
typeof the source to create. Required unlesscustomerandoriginal_sourceare specified (see the Cloning card Sources guide)usagestringPossible valuesreusablesingle_use
Returns
The source object.
curl -X POST https://api.knoxapi.com/v1/sources \
-H "Authorization: Bearer $KNOX_SECRET_KEY"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const response = await stripe.rawRequest('POST', '/v1/sources');import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
response = client.raw_request("post", "/v1/sources")require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
response = Stripe.raw_request(:post, '/v1/sources'){
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"bank_name": "TEST BANK",
"fingerprint": "ecpwEzmBOSMOqQTL",
"routing_number": "110000000",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_XDGV5PcFpAfh4klG76nYn6gH",
"created": 1234567890,
"currency": "usd",
"flow": "receiver",
"id": "src_1Pgc75B7WZ01zgkWn9ogkWOr",
"livemode": false,
"metadata": {},
"object": "source",
"owner": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable",
"allow_redisplay": null
}Update a source
POST/v1/sources/{source}
Updates the specified source by setting the values of the parameters passed. Any parameters not provided will be left unchanged. This request accepts the metadata and owner as arguments. It is also possible to update type specific information for selected payment methods. Please refer to our payment method guides for more detail.
Path parameters
sourcestringRequired
Body parameters
amountintegerAmount associated with the source.
expandarray of stringsSpecifies which fields in the response should be expanded.
mandateobjectInformation about a mandate possibility attached to a source object (generally for bank debits) as well as its acceptance status.
Show 5 child parameters
acceptanceobjectShow 7 child parameters
statusstringRequiredPossible valuesacceptedpendingrefusedrevoked
dateintegeripstringofflineobjectChild parameters are listed in the OpenAPI document.
onlineobjectChild parameters are listed in the OpenAPI document.
typestringPossible valuesofflineonline
user_agentstring
amountintegercurrencystringintervalstringPossible valuesone_timescheduledvariable
notification_methodstringPossible valuesdeprecated_noneemailmanualnonestripe_email
metadataobjectSet of key-value pairs that you can attach to an object. This can be useful for storing additional information about the object in a structured format. Individual keys can be unset by posting an empty value to them. All keys can be unset by posting an empty value to
metadata.ownerobjectInformation about the owner of the payment instrument that may be used or required by particular source types.
Show 4 child parameters
addressobjectShow 6 child parameters
citystringcountrystringline1stringline2stringpostal_codestringstatestring
emailstringnamestringphonestring
source_orderobjectInformation about the items and shipping associated with the source. Required for transactional credit (for example Klarna) sources before you can charge it.
Show 2 child parameters
itemsarray of objectsShow 6 child parameters
amountintegercurrencystringdescriptionstringparentstringquantityintegertypestringPossible valuesdiscountshippingskutax
shippingobjectShow 5 child parameters
addressobjectRequiredChild parameters are listed in the OpenAPI document.
carrierstringnamestringphonestringtracking_numberstring
Returns
The source object.
curl https://api.knoxapi.com/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr \
-H "Authorization: Bearer $KNOX_SECRET_KEY" \
-d "metadata[order_id]=6735"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const response = await stripe.rawRequest('POST', '/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr', {
metadata: {
order_id: '6735',
},
});import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
response = client.raw_request("post", "/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr", metadata={
"order_id": "6735",
})require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
response = Stripe.raw_request(:post, '/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr', {
metadata: {
order_id: '6735',
},
}){
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"bank_name": "TEST BANK",
"fingerprint": "ecpwEzmBOSMOqQTL",
"routing_number": "110000000",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_XDGV5PcFpAfh4klG76nYn6gH",
"created": 1234567890,
"currency": "usd",
"flow": "receiver",
"id": "src_1Pgc75B7WZ01zgkWn9ogkWOr",
"livemode": false,
"metadata": {},
"object": "source",
"owner": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable",
"allow_redisplay": null
}Retrieve a source
GET/v1/sources/{source}
Retrieves an existing source object. Supply the unique source ID from a source creation request and Stripe will return the corresponding up-to-date source object information.
Path parameters
sourcestringRequired
Query parameters
client_secretstringThe client secret of the source. Required if a publishable key is used to retrieve the source.
expandarray of stringsSpecifies which fields in the response should be expanded.
Returns
The source object.
curl https://api.knoxapi.com/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr \
-H "Authorization: Bearer $KNOX_SECRET_KEY"const Stripe = require('stripe');
const stripe = new Stripe(process.env.KNOX_SECRET_KEY, {host: 'api.knoxapi.com'});
const response = await stripe.rawRequest('GET', '/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr');import os
import stripe
client = stripe.StripeClient(
os.environ["KNOX_SECRET_KEY"],
base_addresses={"api": "https://api.knoxapi.com"},
)
response = client.raw_request("get", "/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr")require 'stripe'
Stripe.api_key = ENV['KNOX_SECRET_KEY']
Stripe.api_base = 'https://api.knoxapi.com'
response = Stripe.raw_request(:get, '/v1/sources/src_1Pgc75B7WZ01zgkWn9ogkWOr'){
"ach_credit_transfer": {
"account_number": "test_52796e3294dc",
"bank_name": "TEST BANK",
"fingerprint": "ecpwEzmBOSMOqQTL",
"routing_number": "110000000",
"swift_code": "TSTEZ122"
},
"amount": null,
"client_secret": "src_client_secret_XDGV5PcFpAfh4klG76nYn6gH",
"created": 1234567890,
"currency": "usd",
"flow": "receiver",
"id": "src_1Pgc75B7WZ01zgkWn9ogkWOr",
"livemode": false,
"metadata": {},
"object": "source",
"owner": {
"address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"email": "[email protected]",
"name": null,
"phone": null,
"verified_address": {
"city": null,
"country": null,
"line1": null,
"line2": null,
"postal_code": null,
"state": null
},
"verified_email": null,
"verified_name": null,
"verified_phone": null
},
"receiver": {
"address": "121042882-38381234567890123",
"amount_charged": 0,
"amount_received": 0,
"amount_returned": 0,
"refund_attributes_method": "email",
"refund_attributes_status": "missing"
},
"statement_descriptor": null,
"status": "pending",
"type": "ach_credit_transfer",
"usage": "reusable",
"allow_redisplay": null
}Operations and schemas come from the pinned Stripe OpenAPI specification (MIT); response examples from its fixtures. Nested object definitions and enums are in the complete specification.