WP Simple Pay: Programmatically Access Payment Metadata After Payment

/** * @link https://library.wpcode.com/snippet/3234p8or/ * * @param StripeEvent $event Stripe Event. * @param StripeSubscription|StripePaymentIntent $object Stripe Subscription or PaymentIntent */ function simpay_custom_create_user( $event, $object ) { $metadata = $object->metadata->toArray(); // Access a custom field with a “Stripe Metadata Label” of…Continue reading

WP Simple Pay: Add More Aggressive Rate Limiting

/** * @link https://library.wpcode.com/snippet/r5p3r9o8/ */ /** * Lower the number of requests allowed for the set timeframe to 3 (default 5). */ add_filter( ‘simpay_rate_limiting_max_rate_count’, /** * @return int The number of requests that can be made in the timeframe. */…Continue reading

WP Simple Pay: Use Custom Field Value as Stripe Payment Description

/** * @link https://library.wpcode.com/snippet/e5wnp95d/ */ add_filter( ‘simpay_get_paymentintent_args_from_payment_form_request’, /** * @param array $paymentintent_args Arguments for PaymentIntent. * @param SimplePay\Core\Abstracts\Form $form Form instance. * @param array $form_data Form data generated by the client. * @param array $form_values Values of named fields in…Continue reading

WP Simple Pay: Custom Server-Side Validation Before Payment Creation

/** * @link https://library.wpcode.com/snippet/ro8wgkow/ */ add_action( ‘simpay_before_payment_create’, /** * @param \WP_REST_Request WordPress REST API request. */ function( $request ) { // “Stripe Metadata Label” of the custom field. $custom_field_name = ‘Customer DOB’; // Retrieve form values. $fields = $request->get_param( ‘form_values’…Continue reading