SDK reference · Python SDK
prov.authorize.issuer.approvals.create
prov.authorize.issuer.approvals.create in Python SDK. Ask the cardholder before checkout, or after a decline (decision_id).
Signature
prov.authorize.issuer.approvals.create(**body: Any = …) -> AnyParameters
**bodyAny
Request fields
program_idstringRequired- The program (
iprg_). card_tokenstringRequired- The processor's card token (a card number is refused).
agent_keystringRequired- The agent key (
agent.key). cartobjectRequired- The cart, as cart approvals take it; its
originis the store. displayobjectmerchant_nameto show (default: the store's domain).merchantobject- Acquirer merchant
idsand descriptor patterns (descriptors) the store is known by. decision_idstring- The declined decision this answers: its merchant is copied.
expires_ininteger- Seconds the cardholder has to answer (60 to 3600).
deliveryobject- As on cart approvals (default: the link is returned, nothing is sent).
contactobject- As on cart approvals.
customer_sourceenum- As on cart approvals. One of
merchant_account. channelsobject- As on cart approvals.
billing_addressobject- The cardholder's billing (home) address on file, when you send it: the approval's
approval_context.location_matchsays whether the answer matched it. Kept sealed with the approval.Show child attributes
line1string | null- The street line.
line2string | null- The second line (apartment, suite, unit).
citystring | null- The city.
regionstring | null- The state, province or region: a code (
OR,US-OR) or a name (Oregon). US states, Canadian provinces and territories and Australian states map to ISO 3166-2; any other region is kept for comparison only and its region fact is absent (region_unrecognized). postal_codestring | null- The postal or ZIP code.
countrystringRequired- ISO 3166-1 alpha-2 (
US). Required. locationobject | null- The address's point, when your store has one. Sealed with the address. With it, the distance facts (
approval.distance_km_billing,approval.min_distance_km_billing) work without a geocoder; without it, the server's geocoder finds the postal code's centre, or the distance facts are absent (geocoder_not_configured).Show child attributes
latnumberRequired- Latitude, in degrees.
lngnumberRequired- Longitude, in degrees.
Returns
Any The approval was asked for.
HTTP operation
POST /v1/authorize/issuer_approvals: Ask the cardholder to approve a cart
Errors
- authentication_required
- card_number_refused
- insufficient_scope
- parameter_invalid
- parameter_missing
- plan_required
- rate_limit_exceeded
- resource_missing
Example
const step1 = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/issuer_programs`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"name": "Fernhill agent cards",
"processor": "lithic",
"mode": "live"
}),
})).json();
const program = step1.id;
const data = await (await fetch(`${process.env.PROVENANCE_API}/v1/authorize/issuer_approvals`, {
method: "POST",
headers: { Authorization: "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x", "Content-Type": "application/json" },
body: JSON.stringify({
"program_id": program,
"card_token": "card_tok_fernhill_4",
"agent_key": "token_requestor:40010030273",
"cart": {
"order_id": "ord_fernhill_41",
"total": 24900,
"currency": "USD",
"merchant_id": "brightbox",
"origin": "https://brightbox.example",
"items": [
{
"sku": "tv-55",
"name": "55-inch television",
"quantity": 1,
"unit_amount": 24900
}
]
},
"display": {
"merchant_name": "Brightbox Electronics"
}
}),
})).json();import os
import httpx
api = os.environ["PROVENANCE_API"]
step1 = httpx.post(f"{api}/v1/authorize/issuer_programs", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"name": "Fernhill agent cards",
"processor": "lithic",
"mode": "live"
}).json()
program = step1["id"]
data = httpx.post(f"{api}/v1/authorize/issuer_approvals", headers={"Authorization": "Bearer prv_test_ent_E7nT2vQ9bW4mK8sYd3cFjLh6gAe1pR5x"}, json={
"program_id": program,
"card_token": "card_tok_fernhill_4",
"agent_key": "token_requestor:40010030273",
"cart": {
"order_id": "ord_fernhill_41",
"total": 24900,
"currency": "USD",
"merchant_id": "brightbox",
"origin": "https://brightbox.example",
"items": [
{
"sku": "tv-55",
"name": "55-inch television",
"quantity": 1,
"unit_amount": 24900
}
]
},
"display": {
"merchant_name": "Brightbox Electronics"
}
}).json()