Repository navigation
API Payments
Caligrafy Quill 2.26.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.
Stripe and cryptocurrency payments.
| Class | What it is |
|---|---|
Caligrafy\Payment |
The Payment handles all payment transactions |
Caligrafy\CryptoPayment |
CryptoPayment accepts crypto payments (USDC) through the Coinbase Business Checkouts API. |
namespace Caligrafy;
class Payment extends \stdClassSource: framework/core/Payment.php:19
The Payment handles all payment transactions
->__construct()->createTransaction()->createPaymentIntent()->retrieveIntent()->createCheckout()->retrieveCheckout()->createAccount()->createAccountLink()->createLoginLink()->updateAccount()->retrieve()->getPublicKey()
public function __construct()Constructs the Payment Controller to initiate the Stripe api
Source: framework/core/Payment.php:48
public function createTransaction(
$amount,
$currency,
$card,
$receipt_email = null,
$metadata = null,
$description = '',
$transfer = array(),
$save = false
)Creates a new payment transaction
Parameters
-
$amountInteger: defines the amount of the transaction in cents -
$currencystring: defines the currecy of the transaction -
$cardObject: takes the card object submitted -
$receipt_emailstring, defaultnull: takes the customer email -
$metadatastring, defaultnull: defines the metadata information that can be passed on to the transaction -
$descriptionstring, default'': defines the description that can be passed on to the transaction -
$transfer, defaultarray() -
$saveboolean, defaultfalse: 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
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
-
$amountInteger: defines the amount of the transaction in cents -
$currencystring: defines the currecy of the transaction -
$metadatastring, defaultarray(): defines the metadata information that can be passed on to the transaction -
$receipt_emailstring, defaultnull: defines the email address where the receipt should be sent -
$descriptionstring, default'': defines a description of the product beind sold -
$transferarray, defaultarray(): 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
public function retrieveIntent($intentId)Retrieve Payment Intent
Parameters
-
$intentIdstring
Returns $result: to report on the result of the creation
Source: framework/core/Payment.php:158
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
-
$amountInteger, default1000: defines the amount of the transaction in cents -
$currencystring, default'usd': defines the currency of the transaction -
$quantitystring, default1: defines the quantity of products -
$productDatastring, defaultarray(): defines the product information that can be passed on to the transaction -
$successUrlstring, default'': defines the url that it will redirect to when successful payment -
$cancelUrlstring, default'': defines the url that it will redirect to when the payment fails -
$customerEmail, defaultnull -
$locale, defaultnull -
$paymentTypearray, defaultnull: defines the different payment methods to be supported by checkout -
$payment_intent_dataarray, defaultarray(): . Potential attributes: 'application_fee_amount' for charging vendors -
$vendorarray, defaultarray(): . 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
public function retrieveCheckout($sessionId)Retrieve Checkout Session
Parameters
-
$sessionIdstring
Returns $result: to report on the result of the creation
Source: framework/core/Payment.php:256
public function createAccount(
$email = null,
$country = null,
$type = 'express',
$capabilities = array(),
$accountInformation = array()
)No doc comment.
Parameters
-
$email, defaultnull -
$country, defaultnull -
$type, default'express' -
$capabilities, defaultarray() -
$accountInformation, defaultarray()
Source: framework/core/Payment.php:283
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
public function createLoginLink($accountId)No doc comment.
Parameters
$accountId
Source: framework/core/Payment.php:333
public function updateAccount($accountId, $updates)No doc comment.
Parameters
$accountId$updates
Source: framework/core/Payment.php:350
public function retrieve($accountId)No doc comment.
Parameters
$accountId
Source: framework/core/Payment.php:365
public function getPublicKey()Accessor that returns the public key
Source: framework/core/Payment.php:386
namespace Caligrafy;
class CryptoPayment extends \stdClassSource: framework/core/CryptoPayment.php:26
CryptoPayment accepts crypto payments (USDC) through the Coinbase Business Checkouts API.
Coinbase Commerce (api.commerce.coinbase.com, CRYPTO_PAY_KEY) shut down on March 31, 2026. Its successor is the Checkouts API of Coinbase Business (https://business.coinbase.com/api/v1/checkouts), available to merchants in the supported countries. Requests are authenticated with a short-lived JWT signed with a CDP API key:
- COINBASE_API_KEY_NAME: the key name, e.g. organizations/{org_id}/apiKeys/{key_id}
- COINBASE_API_KEY_SECRET: the Ed25519 secret (base64) or the ECDSA private key (PEM, legacy keys)
->__construct()->createTransaction()->cancelTransaction()->refundTransaction()->getCharges()->getCharge()->getChargeStatus()->coinbaseRequest()->jwt()
public function __construct($keyName = null, $keySecret = null)Parameters
-
$keyNamestring, defaultnull: CDP API key name (defaults to COINBASE_API_KEY_NAME) -
$keySecretstring, defaultnull: CDP API key secret (defaults to COINBASE_API_KEY_SECRET)
Source: framework/core/CryptoPayment.php:53
public function createTransaction(
$amount,
$currency,
$charge = array(),
$metadata = array(),
$redirectUrl = '',
$cancelUrl = '',
$expiresAt = null
)Creates a hosted checkout (single-use payment page)
Parameters
-
$amountstring|float: the amount (2 decimals at most) -
$currencystring: USDC or a fiat currency (USD, EUR, GBP, SGD...) converted to USDC at creation -
$chargearray, defaultarray(): 'name' and 'description' of the product -
$metadataarray, defaultarray(): up to 20 string pairs -
$redirectUrlstring, default'': HTTPS URL to come back to after a successful payment -
$cancelUrlstring, default'': HTTPS URL to come back to after a failed payment -
$expiresAtstring, defaultnull: RFC 3339 expiration date (default: 24 hours)
Returns array: ['action_success' => bool, 'url' => hosted payment page, 'data' => checkout (data['hosted_url'] kept for older code)]
Source: framework/core/CryptoPayment.php:72
public function cancelTransaction($id)Deactivates an active checkout so that it can no longer be paid
Parameters
$id
Source: framework/core/CryptoPayment.php:96
public function refundTransaction($id, $amount = null, $currency = 'USDC', $reason = '')Refunds a completed checkout (full refund when $amount is null)
Parameters
$id-
$amount, defaultnull -
$currency, default'USDC' -
$reason, default''
Source: framework/core/CryptoPayment.php:104
public function getCharges($filters = array())Lists the checkouts. $filters: status, startTime, endTime, descriptionQuery, pageSize, pageToken
Parameters
-
$filters, defaultarray()
Source: framework/core/CryptoPayment.php:115
public function getCharge($chargeId)Retrieves a checkout by id
Parameters
$chargeId
Source: framework/core/CryptoPayment.php:124
public function getChargeStatus($chargeId)Returns the status of a checkout: ACTIVE, PROCESSING, COMPLETED, EXPIRED, FAILED, DEACTIVATED, REFUNDED, PARTIALLY_REFUNDED, or 'unknown'
Parameters
$chargeId
Source: framework/core/CryptoPayment.php:133
public function coinbaseRequest($requestPath, $requestMethod, $body = null, $additionalHeaders = array())Sends an authenticated request to the Checkouts API
Parameters
$requestPath$requestMethod-
$body, defaultnull -
$additionalHeaders, defaultarray()
Returns array: ['action_success' => bool, 'data' => decoded response] or ['action_success' => false, 'error' => message]
Source: framework/core/CryptoPayment.php:143
public function jwt($method, $path)Builds the JWT that authenticates one request (valid 120 seconds) Ed25519 keys (base64, 64 bytes) are signed with EdDSA, PEM EC keys with ES256
Parameters
$method$path
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.
Why Caligrafy: the benefits, the measurements, and what it is not yet
-
Quickstart with Claude: describe it, approve it, ship it
or the Quickstart: the same three steps by hand, in 5 minutes
- How Caligrafy works: the ideas in 5 minutes
- Your first capability: build a feature, page included
-
Capabilities in depth
-
#[Capability]: every option - Scheduled jobs: capabilities on a timer
- Notifications: web push and email
- Background jobs: capabilities run later
- Migrations: database changes, in order
- The cache
-
Testing your app
- Dependency injection
- Validation rules
-
Web pages
- Views and page components
- Design styles: another look, one setting
- Declarative routes: every request, in one line
-
Route::page·Route::form·Route::auth·Route::webhook·Route::download·Route::redirect·Route::action·Route::snap· capability routes - How to export a list as CSV
- Controllers: moving one to a declared route · how to, step by step
- Forms and helpers
-
Vue apps
-
Mobile and tablet
-
REST API
-
AI agents
-
Snap Cards and the assistant
- Payments: Stripe and crypto
- Face detection and face login
- OpenAI: chat and images · Assistants
- Open models: Llama, Mistral...
- Chatbots with Watson
- Machine learning in the browser
- Metadata and social cards · search and analytics
-
Putting it online: the production image, the database at every start
-
API reference: every class and method
-
Routing ·
Route·AuthRoutes· pages ·Controller· capabilities -
Data ·
Model·Query· sign-in · jobs ·Notify· payments · AI -
Interfaces · Snap ·
Snap\Cards·Snap\Conversation· testing · tooling · helper functions
-
Routing ·
-
Caligrafer: every command
- Project · build · data · agents · jobs and tests · maintenance · deploy
- Installation, configuration and Caligrafer
- Routing · Request · Controllers · Views
- Vue: flow of information · routes · validations
- Security and upgrading
- Release notes: 2.26 · 2.25 · 2.24 · 2.23 · 2.22 · 2.21 · 2.20 · 2.19 · 2.18 · 2.17 · 2.16 · 2.15 · 2.14 · 2.13 · 2.12 · 2.11 · 2.10 · 2.9 · 2.8 · 2.7 · 2.6 · 2.5 · 2.4 · 2.3 · 2.1 · October 2026 · changelog
- Testing Caligrafy (contributors)