Skip to content
QR code to Stripe paymentsQR2Stripe documentation

← All guides

Integrate with WordPress plugins

Developers can create payments and respond to verified payment events from another plugin on the same WordPress site.

Create a payment with qr2stripe_create_payment; amount is in minor currency units and reference identifies your order. Prefix the reference to avoid collisions with other plugins. Save the returned payment ID and use qr2stripe_get_payment to retrieve it; a missing payment returns null. The payment page URL comes from qr2stripe_payment_page_url.

Actions: qr2stripe_payment_created receives the stored payment; qr2stripe_payment_cancelled receives the payment cancelled in the admin; qr2stripe_payment_paid receives the payment and Stripe PaymentIntent after webhook verification; qr2stripe_payment_mismatch receives the previous payment, PaymentIntent and problems; qr2stripe_duplicate_payment receives the payment and a second PaymentIntent.

Hooks run synchronously and are not a guaranteed delivery queue. Handle events idempotently and reconcile failures using the stored payment ID. Expiry is calculated by QR2Stripe_Store::effective_status and does not fire an action. Payment rows contain tokens and the PaymentIntent contains Stripe data; do not expose them publicly. These hooks do not send data to other services by themselves.

// Call this from your order flow, once the order is ready for payment.
function myplugin_create_payment() {
    if (!function_exists('qr2stripe_create_payment')) return;
    $payment = qr2stripe_create_payment([
        'amount' => 12900, // 129.00 CZK
        'currency' => 'czk',
        'reference' => 'myplugin-order-123',
    ]);
    if (!is_wp_error($payment)) {
        $payment_id = $payment['id']; // Store this with your order.
        $url = qr2stripe_payment_page_url($payment);
    }
}

add_action('qr2stripe_payment_paid', function ($payment, $payment_intent) {
    // Match your order by reference and mark it paid idempotently.
}, 10, 2);