FileAccess Orion

Stripe extends BasePaymentMethod
in package

Implement payment method

Tags
category

Interface function

author

Tobias Teichner webmaster@teichner.biz

since

File available since v6.15.13

Table of Contents

$config_file  : string
Path to config file or name
$default_config_file  : string
Path to default config file
$name  : string|null
$partial_payments  : bool
Partial payment support
$preset_file  : string
Absolute path to preset file
$settings  : object|null
Setup The local setup object
$clients  : array<string|int, mixed>
Buffer of clients
$default_mode  : string
The default mode
$git_repo  : array<string|int, mixed>
Array of repo instances
$mode  : string
Store the mode for this instance, can be either test or, live
$prices  : array<string|int, mixed>
Buffer for prices
$products  : array<string|int, mixed>
Products cache
__construct()  : mixed
Cash constructor.
BasketProcessable()  : Result
Check if the basket can be processed using this method
CalculatePrice()  : Result
Calculate price Calculate the price for this payment method
CancelSubscription()  : Result
Status transit subscription to canceled
ChangeSubscriptionRate()  : Result
Change price or tax in next period
CheckPrice()  : Result
Check if price is too high or too low
Collect()  : Result
Collect the amount of a marked basket
CompleteSetupIntent()  : Result
Finish setup intent result operation and link with profile
Config()  : Settings|null
connect
ConfirmPaymentIntent()  : Result
Confirm a payment intent
CreateAccount()  : Result
Create a new connect account based on an existing company
CreateAccountOnboardLink()  : Result
Generate an onboarding link for an existing account
CreatePaymentMethod()  : Result
Register a full payment method with "public" data of user
createProduct()  : Result
Create product for recurring usage
CreateSubscriptionsFromBasket()  : Result
Register subscriptions
CreateTaxRate()  : Result
CustomerAttachMethod()  : Result
Link a payment method to a customer
CustomerInvoices()  : Result
Fetch all invoice documents of certain customer
CustomerPaymentMethods()  : Result
CustomerSetDefaultMethod()  : Result
Set the default invoice payment method
DefaultMode()  : string|null
DeleteTaxRate()  : Result
DropCustomer()  : Result
Drop a customer
EndTrailOfBasket()  : Result
End the free test period of a basket immediately
EndTrailOfSubscription()  : Result
ExternalTransactionDocument()  : Result
Get bill of a subscription
ExtractCustomerOfUser()  : array<string|int, mixed>|null
Get the customer extracted from user and the mode he is in
FetchAccount()  : Result
Get a single account
FetchLegacyConfiguration()  : Result
Load a legacy configuration to this instance
FetchPrice()  : Result
FetchProduct()  : Result
Fetch products list
FetchSetupIntentMethod()  : Result
GetCustomer()  : Result
Extract the customer account of a user
GetCustomerOfUser()  : Result
Extract the customer account of a user
GetDefaultSettings()  : Result
Load defaults
GetFormPreset()  : Result
preset load the common pickup settings preset for generation a form
GetPaymentIntentDetails()  : Result
Gent information about a certain payment intent
GetRefundDetails()  : Result
Fetch details of certain refund
GetSetting()  : mixed|null
Get a single setting with support fallback to defaults
GetSettings()  : Result
get load the common pickup settings object
GetSubscriptionDetails()  : Result
Fetch details of certain subscription
GitRepo()  : Git
Git object
InitAnonymousSetupIntent()  : Result
InitSetupIntent()  : Result
Trigger setup intent for new method
IsTest()  : bool
Is in test system, identify by flag
MaximumPrice()  : float|null
Get the max overall price
MinimumPrice()  : float|null
Get the min overall price
Mode()  : string
Getter/Setter for mode
Name()  : string
Get the name
PlaceOrder()  : Result
Place order call Called on place order of related basket, either pays it immediately or registers for later collection
Priority()  : int
Get the set priority
RefundAmount()  : Result
Refund a certain transaction on a linked basket
RegisterOrder()  : Result
register order callback called on register order of related basket
RegisterReplacementOrder()  : Result
Switch to different subscription model
RegisterUserAsCustomer()  : Result
Register a stripe customer based on our user instance
RequireRedirect()  : bool
Requires a redirect to process?
ResolveBasketUsedMethod()  : Data|null
Get the payment method details for bank and cards
RetrieveInvoice()  : Result
Get information about a certain payment intent
RetrievePaymentIntent()  : Result
Get information about a certain payment intent
ReverseCancelOrder()  : mixed
Restore an existing order
SearchPrices()  : Result
Search prices table with products
SearchTaxRates()  : Result
List tax rates
SettingsValid()  : bool
Check configuration
StatusAfterDone()  : string
The status after done
StopCancelSubscription()  : Result
StoreSettings()  : Result
Store the common settings object
SupportPartialPayments()  : bool
Has support for partial payments?
UpdateSubscriptionPayment()  : Result
Update the payment method of a certain subscription
UpdateSubscriptionPrice()  : Result
Change to other pricing model
UpdateUserAsCustomer()  : Result
UserPaymentMethod()  : Result
UserPaymentMethods()  : Result
UserSetDefaultMethod()  : Result
Set default payment method based on given user object
extractCustomerOfId()  : array<string, string>
External id resolver with prefix support of stage
loadLocalSettings()  : void
load settings object from local storage
sendWarning()  : mixed
Send an email including the given parameters to admin
_customerPaymentMethods()  : Result
Fetch list of existing customers methods
client()  : StripeClient|null
Get a client instance
finalizeInvoice()  : Result
registerEndpoint()  : Result
Register endpoint on the fly

Properties

$default_config_file

Path to default config file

protected string $default_config_file = ''

$partial_payments

Partial payment support

protected bool $partial_payments = false

$preset_file

Absolute path to preset file

protected string $preset_file = ''

$settings

Setup The local setup object

protected object|null $settings = null

A setup object

$clients

Buffer of clients

private array<string|int, mixed> $clients = []

$git_repo

Array of repo instances

private array<string|int, mixed> $git_repo = []

$mode

Store the mode for this instance, can be either test or, live

private string $mode = 'live'

$prices

Buffer for prices

private array<string|int, mixed> $prices = []

$products

Products cache

private array<string|int, mixed> $products = []

Methods

__construct()

Cash constructor.

public __construct() : mixed
Return values
mixed

BasketProcessable()

Check if the basket can be processed using this method

public BasketProcessable(Basket $basket) : Result
Parameters
$basket : Basket

A system basket object

Return values
Result

A system result object

CalculatePrice()

Calculate price Calculate the price for this payment method

public CalculatePrice(array<string|int, ArticleAssignment$articles) : Result

ToDo: The delivery and packaging fee taxes should be equally split among the taxes of the shipped items

Parameters
$articles : array<string|int, ArticleAssignment>

A list of basic contents

Return values
Result

A system result object

CancelSubscription()

Status transit subscription to canceled

public CancelSubscription(string $id, Basket $basket, int $date[, bool $by_plan = false ]) : Result
Parameters
$id : string

The subscription id in Stripe

$basket : Basket

The related basket

$date : int

Optional end date, when set the subscription will end at their regular end time

$by_plan : bool = false
Return values
Result

ChangeSubscriptionRate()

Change price or tax in next period

public ChangeSubscriptionRate(string $id, float $tax, string $price_id[, string|null $free_until_date = null ]) : Result
Parameters
$id : string

The subscription id

$tax : float

The tax rate as number

$price_id : string

The target price id

$free_until_date : string|null = null

Additional period while this subscription will not cost, requires 0 amount price id

Return values
Result

Collect()

Collect the amount of a marked basket

public Collect(Basket $basket) : Result
Parameters
$basket : Basket
Tags
inheritDoc
Return values
Result

CompleteSetupIntent()

Finish setup intent result operation and link with profile

public CompleteSetupIntent(string $intentId, User|null $user) : Result
Parameters
$intentId : string
$user : User|null
Return values
Result

Config()

connect

public Config([string|null $mode = null ]) : Settings|null

load settings object from local storage this method is cached

Parameters
$mode : string|null = null
Return values
Settings|null

ConfirmPaymentIntent()

Confirm a payment intent

public ConfirmPaymentIntent(string $tid, string $mid[, User|null $user = null ]) : Result
Parameters
$tid : string
$mid : string
$user : User|null = null
Return values
Result

CreateAccount()

Create a new connect account based on an existing company

public CreateAccount(Company $company) : Result
Parameters
$company : Company
Return values
Result

Generate an onboarding link for an existing account

public CreateAccountOnboardLink(string $id, string $refresh_url, string $return_url) : Result
Parameters
$id : string
$refresh_url : string
$return_url : string
Return values
Result

CreatePaymentMethod()

Register a full payment method with "public" data of user

public CreatePaymentMethod(Data $methodData, Address $address) : Result
Parameters
$methodData : Data
$address : Address
Return values
Result

createProduct()

Create product for recurring usage

public createProduct(array<string|int, mixed> $data) : Result
Parameters
$data : array<string|int, mixed>
Return values
Result

CreateSubscriptionsFromBasket()

Register subscriptions

public CreateSubscriptionsFromBasket(Basket $basket[, Customer|null $customer = null ][, PaymentMethod|null $payment_method = null ]) : Result
Parameters
$basket : Basket
$customer : Customer|null = null
$payment_method : PaymentMethod|null = null
Tags
throws
Exception
Return values
Result

CreateTaxRate()

public CreateTaxRate(array<string|int, mixed> $data) : Result
Parameters
$data : array<string|int, mixed>
Return values
Result

CustomerAttachMethod()

Link a payment method to a customer

public CustomerAttachMethod(string $customer_id, string $method_id) : Result
Parameters
$customer_id : string
$method_id : string
Return values
Result

CustomerInvoices()

Fetch all invoice documents of certain customer

public CustomerInvoices(User $user, array<string|int, mixed>|null $filter) : Result

Can filter by subscription and status or a unique stripe invoice id

Parameters
$user : User
$filter : array<string|int, mixed>|null
Return values
Result

CustomerPaymentMethods()

public CustomerPaymentMethods(string $customerId, array<string|int, mixed> $filter) : Result
Parameters
$customerId : string
$filter : array<string|int, mixed>
Return values
Result

CustomerSetDefaultMethod()

Set the default invoice payment method

public CustomerSetDefaultMethod(string $customer_id, string $method_id) : Result
Parameters
$customer_id : string
$method_id : string
Return values
Result

DefaultMode()

public DefaultMode() : string|null
Return values
string|null

DeleteTaxRate()

public DeleteTaxRate(string $id) : Result
Parameters
$id : string
Return values
Result

DropCustomer()

Drop a customer

public DropCustomer(Customer $account) : Result
Parameters
$account : Customer
Return values
Result

EndTrailOfBasket()

End the free test period of a basket immediately

public EndTrailOfBasket(Basket $basket[, string|null $date_to = null ]) : Result
Parameters
$basket : Basket

The basket reference

$date_to : string|null = null

Optional alternative free period end date

Return values
Result

EndTrailOfSubscription()

public EndTrailOfSubscription(string $id, Basket $basket[, string|null $date_to = null ]) : Result
Parameters
$id : string
$basket : Basket
$date_to : string|null = null
Return values
Result

ExternalTransactionDocument()

Get bill of a subscription

public ExternalTransactionDocument(array<string|int, mixed> &$transaction, Basket $basket) : Result
Parameters
$transaction : array<string|int, mixed>
$basket : Basket
Return values
Result

The result object

ExtractCustomerOfUser()

Get the customer extracted from user and the mode he is in

public ExtractCustomerOfUser([User|null $user = null ][, bool $fb = false ][, string|null $name = null ]) : array<string|int, mixed>|null
Parameters
$user : User|null = null
$fb : bool = false
$name : string|null = null
Return values
array<string|int, mixed>|null

FetchAccount()

Get a single account

public FetchAccount(string $id) : Result
Parameters
$id : string
Return values
Result

FetchLegacyConfiguration()

Load a legacy configuration to this instance

public FetchLegacyConfiguration(string $hash) : Result
Parameters
$hash : string

A git hash with the used delivery method version

Return values
Result

A system result object

FetchPrice()

public FetchPrice(string $id, string $mode) : Result
Parameters
$id : string
$mode : string
Return values
Result

FetchProduct()

Fetch products list

public FetchProduct(string $id, string $mode) : Result
Parameters
$id : string
$mode : string
Return values
Result

FetchSetupIntentMethod()

public FetchSetupIntentMethod(string $intentId) : Result
Parameters
$intentId : string
Return values
Result

GetCustomer()

Extract the customer account of a user

public GetCustomer(string $ext_id) : Result
Parameters
$ext_id : string
Return values
Result

GetCustomerOfUser()

Extract the customer account of a user

public GetCustomerOfUser(User $user) : Result
Parameters
$user : User
Return values
Result

GetDefaultSettings()

Load defaults

public GetDefaultSettings() : Result

Load the default settings for this delivery method

Return values
Result

A system result object

GetFormPreset()

preset load the common pickup settings preset for generation a form

public GetFormPreset() : Result
Return values
Result

A system result object

GetPaymentIntentDetails()

Gent information about a certain payment intent

public GetPaymentIntentDetails(string $tid[, User|null $user = null ]) : Result
Parameters
$tid : string
$user : User|null = null
Return values
Result

GetRefundDetails()

Fetch details of certain refund

public GetRefundDetails(string $id, Basket $basket) : Result
Parameters
$id : string
$basket : Basket
Return values
Result

GetSetting()

Get a single setting with support fallback to defaults

public GetSetting(string $name) : mixed|null
Parameters
$name : string

The key of the name

Return values
mixed|null

GetSubscriptionDetails()

Fetch details of certain subscription

public GetSubscriptionDetails(string $id[, Basket|null $basket = null ]) : Result
Parameters
$id : string

The external id

$basket : Basket|null = null

The basket to determine context

Return values
Result

GitRepo()

Git object

public GitRepo([string $path = 'data' ]) : Git

Gets the widget git instance, either for config or, for data repo

Parameters
$path : string = 'data'

The target repo, default is data

Return values
Git

A system git object with data folder as start point

InitAnonymousSetupIntent()

public InitAnonymousSetupIntent() : Result
Return values
Result

InitSetupIntent()

Trigger setup intent for new method

public InitSetupIntent(User $user) : Result
Parameters
$user : User
Return values
Result

IsTest()

Is in test system, identify by flag

public IsTest(Basket $basket) : bool
Parameters
$basket : Basket
Return values
bool

MaximumPrice()

Get the max overall price

public MaximumPrice() : float|null
Return values
float|null

MinimumPrice()

Get the min overall price

public MinimumPrice() : float|null
Return values
float|null

Mode()

Getter/Setter for mode

public Mode([string|null $mode = null ]) : string
Parameters
$mode : string|null = null
Return values
string

PlaceOrder()

Place order call Called on place order of related basket, either pays it immediately or registers for later collection

public PlaceOrder(Basket $basket, Request $request, bool $collect_later) : Result
Parameters
$basket : Basket

A system basket object

$request : Request

The related http request

$collect_later : bool

Register but collect later manually

Tags
inheritDoc
Return values
Result

A system result object

Priority()

Get the set priority

public Priority() : int
Return values
int

RefundAmount()

Refund a certain transaction on a linked basket

public RefundAmount(string $transaction, Basket $basket, float $amount) : Result
Parameters
$transaction : string

A stripe payment intent id or a charge id

$basket : Basket

The related basket object

$amount : float

The absolute amount to be charged back

Return values
Result

RegisterOrder()

register order callback called on register order of related basket

public RegisterOrder(Basket $basket, Request $request) : Result
Parameters
$basket : Basket

A system basket object

$request : Request

The related http request

Tags
inheritDoc
Return values
Result

A system result object

RegisterReplacementOrder()

Switch to different subscription model

public RegisterReplacementOrder(Basket $basket, Basket $original[, array<string|int, mixed> $params = [] ]) : Result
Parameters
$basket : Basket
$original : Basket
$params : array<string|int, mixed> = []
Return values
Result

RegisterUserAsCustomer()

Register a stripe customer based on our user instance

public RegisterUserAsCustomer(User $user) : Result
Parameters
$user : User
Return values
Result

RequireRedirect()

Requires a redirect to process?

public RequireRedirect() : bool
Return values
bool

ResolveBasketUsedMethod()

Get the payment method details for bank and cards

public ResolveBasketUsedMethod(Basket $basket) : Data|null
Parameters
$basket : Basket
Return values
Data|null

RetrieveInvoice()

Get information about a certain payment intent

public RetrieveInvoice(string $id[, string|null $mode = null ]) : Result
Parameters
$id : string
$mode : string|null = null
Return values
Result

RetrievePaymentIntent()

Get information about a certain payment intent

public RetrievePaymentIntent(string $id[, string|null $mode = null ]) : Result
Parameters
$id : string
$mode : string|null = null
Return values
Result

ReverseCancelOrder()

Restore an existing order

public ReverseCancelOrder(Basket $basket, Basket $original) : mixed
Parameters
$basket : Basket

The new basket (helper entry from frontend)

$original : Basket

The original subscription basket

Tags
inheritDoc
Return values
mixed

SearchPrices()

Search prices table with products

public SearchPrices(int $start[, int $length = 10 ][, string|null $env = null ]) : Result
Parameters
$start : int
$length : int = 10
$env : string|null = null
Return values
Result

SearchTaxRates()

List tax rates

public SearchTaxRates(int $start[, int $length = 10 ][, string|null $mode = null ]) : Result
Parameters
$start : int
$length : int = 10
$mode : string|null = null
Return values
Result

SettingsValid()

Check configuration

public SettingsValid([Settings|null $cfg = null ]) : bool

Make sure that either a shop or an account portal is completely configured

Parameters
$cfg : Settings|null = null
Return values
bool

StatusAfterDone()

The status after done

public StatusAfterDone(Basket $basket) : string
Parameters
$basket : Basket
Tags
inheritDoc
Return values
string

The status when successfully

StopCancelSubscription()

public StopCancelSubscription(string $id, Basket $basket) : Result
Parameters
$id : string
$basket : Basket
Return values
Result

StoreSettings()

Store the common settings object

public StoreSettings(array<string|int, mixed> $values) : Result
Parameters
$values : array<string|int, mixed>

The configuration values

Return values
Result

$result A system result object

SupportPartialPayments()

Has support for partial payments?

public SupportPartialPayments() : bool
Tags
inheritDoc
Return values
bool

UpdateSubscriptionPayment()

Update the payment method of a certain subscription

public UpdateSubscriptionPayment(string $id, string $method_id, Basket $basket) : Result
Parameters
$id : string

The subscription id in stripe

$method_id : string

The method id in stripe

$basket : Basket

Basket the subscription is linked to

Return values
Result

UpdateSubscriptionPrice()

Change to other pricing model

public UpdateSubscriptionPrice(Basket $basket, string $id, string $price_id[, bool $by_plan = false ]) : Result
Parameters
$basket : Basket

The related basket

$id : string

The affected subscription id

$price_id : string
$by_plan : bool = false
Return values
Result

UserPaymentMethod()

public UserPaymentMethod(User $user, string $id) : Result
Parameters
$user : User
$id : string
Return values
Result

UserPaymentMethods()

public UserPaymentMethods(User $user, array<string|int, mixed> $filter) : Result
Parameters
$user : User
$filter : array<string|int, mixed>
Return values
Result

UserSetDefaultMethod()

Set default payment method based on given user object

public UserSetDefaultMethod(User $user, string $method_id) : Result
Parameters
$user : User
$method_id : string
Return values
Result

extractCustomerOfId()

External id resolver with prefix support of stage

protected extractCustomerOfId(string $ext_id) : array<string, string>
Parameters
$ext_id : string

The external id, with or without mode

Return values
array<string, string>

The parsed id

loadLocalSettings()

load settings object from local storage

protected loadLocalSettings() : void
Return values
void

sendWarning()

Send an email including the given parameters to admin

protected sendWarning(string|Result $message) : mixed
Parameters
$message : string|Result
Return values
mixed

_customerPaymentMethods()

Fetch list of existing customers methods

private _customerPaymentMethods(string $env, string $customerId, array<string|int, mixed> $filter) : Result
Parameters
$env : string
$customerId : string
$filter : array<string|int, mixed>
Return values
Result

client()

Get a client instance

private client([string|null $mode = null ]) : StripeClient|null
Parameters
$mode : string|null = null
Return values
StripeClient|null

finalizeInvoice()

private finalizeInvoice(StripeClient $client, Basket $basket, Invoice $invoice) : Result
Parameters
$client : StripeClient
$basket : Basket
$invoice : Invoice
Tags
throws
ApiErrorException
Return values
Result

registerEndpoint()

Register endpoint on the fly

private registerEndpoint(string $pk, string $url, bool $active) : Result
Parameters
$pk : string

The private key

$url : string

The hook url

$active : bool

Should be active?

Return values
Result

Search results