Skip to content

API Payment

Dory Azar edited this page Nov 25, 2026 · 3 revisions

Caligrafy\Payment

Caligrafy Quill 2.32.0. Generated from the source by php qa/build-api-reference.php; the guides explain how to use these classes, this reference says exactly what each public method takes and returns. Back to the API reference.

Part of Payments.

namespace Caligrafy;

class Payment extends \stdClass

Source: framework/core/Payment.php:19

The Payment handles all payment transactions

Methods

->__construct()

public function __construct()

Constructs the Payment Controller to initiate the Stripe api

Source: framework/core/Payment.php:48

->createTransaction()

public function createTransaction(
    $amount,
    $currency,
    $card,
    $receipt_email = null,
    $metadata = null,
    $description = '',
    $transfer = array(),
    $save = false
)

Creates a new payment transaction

Parameters

  • $amount Integer: defines the amount of the transaction in cents
  • $currency string: defines the currecy of the transaction
  • $card Object: takes the card object submitted
  • $receipt_email string, default null: takes the customer email
  • $metadata string, default null: defines the metadata information that can be passed on to the transaction
  • $description string, default '': defines the description that can be passed on to the transaction
  • $transfer, default array()
  • $save boolean, default false: defines whether the transaction should be saved or not for a particular customer

Returns $result: to report on the result of the creation

Source: framework/core/Payment.php:78

->createPaymentIntent()

public function createPaymentIntent(
    $amount,
    $currency,
    $metadata = array(),
    $receipt_email = null,
    $description = '',
    $transfer = array()
)

Creates a new payment transaction that might require a customer authentication flow (3DSecure for example)

Parameters

  • $amount Integer: defines the amount of the transaction in cents
  • $currency string: defines the currecy of the transaction
  • $metadata string, default array(): defines the metadata information that can be passed on to the transaction
  • $receipt_email string, default null: defines the email address where the receipt should be sent
  • $description string, default '': defines a description of the product beind sold
  • $transfer array, default array(): defines the transfer data to vendors if they exist. keys possible: 'destination' for connected stripe account. 'amount' to define the amount the vendor will receive

Returns $result: to report on the result of the creation

Source: framework/core/Payment.php:124

->retrieveIntent()

public function retrieveIntent($intentId)

Retrieve Payment Intent

Parameters

  • $intentId string

Returns $result: to report on the result of the creation

Source: framework/core/Payment.php:158

->createCheckout()

public function createCheckout(
    $amount = 1000,
    $currency = 'usd',
    $quantity = 1,
    $productData = array(),
    $successUrl = '',
    $cancelUrl = '',
    $customerEmail = null,
    $locale = null,
    $paymentType = null,
    $payment_intent_data = array(),
    $vendor = array()
)

Creates a new integrated checkout session

Parameters

  • $amount Integer, default 1000: defines the amount of the transaction in cents
  • $currency string, default 'usd': defines the currency of the transaction
  • $quantity string, default 1: defines the quantity of products
  • $productData string, default array(): defines the product information that can be passed on to the transaction
  • $successUrl string, default '': defines the url that it will redirect to when successful payment
  • $cancelUrl string, default '': defines the url that it will redirect to when the payment fails
  • $customerEmail, default null
  • $locale, default null
  • $paymentType array, default null: defines the different payment methods to be supported by checkout
  • $payment_intent_data array, default array(): . Potential attributes: 'application_fee_amount' for charging vendors
  • $vendor array, default array(): . Potential array keys: 'stripe_account' for the vendor account

Returns $result: to report on the result of the creation

Source: framework/core/Payment.php:193

->retrieveCheckout()

public function retrieveCheckout($sessionId)

Retrieve Checkout Session

Parameters

  • $sessionId string

Returns $result: to report on the result of the creation

Source: framework/core/Payment.php:256

->createAccount()

public function createAccount(
    $email = null,
    $country = null,
    $type = 'express',
    $capabilities = array(),
    $accountInformation = array()
)

No doc comment.

Parameters

  • $email, default null
  • $country, default null
  • $type, default 'express'
  • $capabilities, default array()
  • $accountInformation, default array()

Source: framework/core/Payment.php:283

->createAccountLink()

public function createAccountLink($accountId, $refreshUrl, $returnUrl, $type = 'account_onboarding')

No doc comment.

Parameters

  • $accountId
  • $refreshUrl
  • $returnUrl
  • $type, default 'account_onboarding'

Source: framework/core/Payment.php:314

->createLoginLink()

public function createLoginLink($accountId)

No doc comment.

Parameters

  • $accountId

Source: framework/core/Payment.php:333

->updateAccount()

public function updateAccount($accountId, $updates)

No doc comment.

Parameters

  • $accountId
  • $updates

Source: framework/core/Payment.php:350

->retrieve()

public function retrieve($accountId)

No doc comment.

Parameters

  • $accountId

Source: framework/core/Payment.php:365

->createTransfer()

public function createTransfer(
    $amount,
    $currency,
    $destination,
    $metadata = array(),
    $transferGroup = null,
    $description = null,
    $idempotencyKey = null
)

Sends money from the platform's Stripe balance to a connected account (Stripe Connect transfer) The platform's available balance must cover the amount, and the connected account needs the 'transfers' capability (createAccount requests it by default)

Parameters

  • $amount integer: the amount in the smallest currency unit (cents for usd: 1250 is $12.50), like createPaymentIntent and createCheckout
  • $currency string: the currency of the transfer ('usd')
  • $destination string: the id of the connected account that receives the money ('acct_...')
  • $metadata array, default array(): key-value pairs kept on the transfer (an ambassador id, a month)
  • $transferGroup string, default null: a string that groups the transfer with related charges or transfers
  • $description string, default null: a description of the transfer
  • $idempotencyKey string, default null: sent as Stripe's Idempotency-Key: a retry with the same key returns the first transfer instead of sending the money twice (a monthly run can be run again safely)

Returns array: array('action_success' => true, 'data' => the Stripe Transfer) or array('action_success' => false, 'error' => the message)

Source: framework/core/Payment.php:390

->retrieveTransfer()

public function retrieveTransfer($transferId)

Retrieves a transfer to a connected account

Parameters

  • $transferId string: the id of the transfer ('tr_...')

Returns array: array('action_success' => true, 'data' => the Stripe Transfer) or array('action_success' => false, 'error' => the message)

Source: framework/core/Payment.php:412

->reverseTransfer()

public function reverseTransfer($transferId, $amount = null)

Reverses a transfer: the money comes back from the connected account to the platform's balance (the connected account's balance must still hold it)

Parameters

  • $transferId string: the id of the transfer ('tr_...')
  • $amount integer, default null: the amount to reverse in the smallest currency unit; null reverses the whole transfer

Returns array: array('action_success' => true, 'data' => the Stripe TransferReversal) or array('action_success' => false, 'error' => the message)

Source: framework/core/Payment.php:431

->getPublicKey()

public function getPublicKey()

Accessor that returns the public key

Source: framework/core/Payment.php:453

Caligrafy: Describe it. Approve it. Ship it. Your idea turned into a complete app: every feature built once, for web pages, Vue apps, a REST API and AI agents, and online.

Start here

Why Caligrafy: the benefits, the measurements, and what it is not yet

  1. Quickstart with Claude: describe it, approve it, ship it

    or the Quickstart: the same three steps by hand, in 5 minutes

  2. How Caligrafy works: the ideas in 5 minutes
  3. Your first capability: build a feature, page included

Capabilities

Experiences

Data and people

  1. Models
  2. Relationships
  3. Queries: filters, paging, related rows
  4. Sign-in, users and tokens

Built-in features

Put it online

Build with AI

Reference

Clone this wiki locally