WP Simple Pay: Create WordPress User After Payment

/** * @link https://library.wpcode.com/snippet/3234p8or/ * * @link https://docs.stripe.com/api/subscriptions/object Subscription object * @link https://docs.stripe.com/api/payment_intents/object PaymentIntent object * @link https://docs.stripe.com/api/customers/object Customer object * * @param \Stripe\Event $event Stripe Event. * @param \Stripe\Subscription|\Stripe\PaymentIntent $object Stripe Subscription or PaymentIntent */ function simpay_custom_create_user( $event, $object…Continue reading

WP Simple Pay: Create WordPress User After Payment (Lite)

/** * @link https://library.wpcode.com/snippet/32j68l5l/ */ add_action( ‘simpay_payment_receipt_viewed’, /** * @param array $payment_confirmation_data { * Contextual information about this payment confirmation. * * @type \SimplePay\Vendor\Stripe\Customer $customer Stripe Customer * @type \SimplePay\Core\Abstracts\Form $form Payment form. * @type array $subscriptions Subscriptions associated with…Continue reading

WP Simple Pay: Custom Webhook Handling Example

/** * @link https://library.wpcode.com/snippet/qorp835k/ * * Wait until WP Simple Pay is fully loaded. */ add_action( ‘init’, function() { require_once( SIMPLE_PAY_INC . ‘pro/webhooks/class-webhook-base.php’ ); require_once( SIMPLE_PAY_INC . ‘pro/webhooks/class-webhook-interface.php’ ); /** * Adds handling for `coupon.updated` webhook. * * @param array…Continue reading

WP Simple Pay: Per-Form Fixed Tax Rate Percentages

/** * @link https://library.wpcode.com/snippet/924rp65g/ * * @param int $percentage Tax rate percentage. * @param \SimplePay\Pro\Taxes\TaxRate[] $tax_rates Tax Rates */ function simpay_find_tax_rate( $percentage, $tax_rates ) { return array_values( array_filter( $tax_rates, function ( $tax_rate ) use ( $percentage ) { return $tax_rate->percentage…Continue reading

WP Simple Pay: Lower reCAPTCHA Threshold

/** * @link https://library.wpcode.com/snippet/qo9eyj21/ */ add_filter( ‘simpay_recpatcha_minimum_score’, /** * @param string $threshold Threshold. Default 0.5 * @return string */ function( $threshold ) { return ‘0.3’; } );Continue reading

Allow SVG/JPEG/WEBP/ICO/AVIF Files Upload

function allow_additional_mime_types($mime_types) { $mime_types[‘jpeg’] = ‘image/jpeg’; $mime_types[‘svg’] = ‘image/svg+xml’; $mime_types[‘webp’] = ‘image/webp’; $mime_types[‘avif’] = ‘image/avif’; $mime_types[‘ico’] = ‘image/vnd.microsoft.icon’; return $mime_types; } add_filter(‘upload_mimes’, ‘allow_additional_mime_types’);Continue reading