formie icon indicating copy to clipboard operation
formie copied to clipboard

Stripe: billing_cycle_anchor

Open hassanmah opened this issue 11 months ago • 3 comments

Question

Is it possible to pass the 1st of the following month as billing_cycle_anchor when using a payment field?

Thanks

Additional context

No response

hassanmah avatar Mar 04 '24 00:03 hassanmah

Not via the UI, but you can achieve this with module code to add your own content to the payload sent to Stripe.

use verbb\formie\events\ModifyPaymentPayloadEvent;
use verbb\formie\integrations\payments\Stripe;
use yii\base\Event;

Event::on(Stripe::class, Stripe::EVENT_MODIFY_SINGLE_PAYLOAD, function(ModifyPaymentPayloadEvent $event) {
    $event->payload['billing_cycle_anchor'] = '123';
});

engram-design avatar Mar 04 '24 14:03 engram-design

@engram-design that event doesn't get fired...

Event::on(Stripe::class, Stripe::EVENT_MODIFY_SINGLE_PAYLOAD, function(ModifyPaymentPayloadEvent $event) {
            // log the event
            Craft::info('Stripe event fired', __METHOD__);

          });

Nothing is being logged

hassanmah avatar Mar 04 '24 14:03 hassanmah

The event does get triggered and have just confirmed on my end. Can you report what version of Formie you're on?

Then again, if this is for a subscription payment, that event will be a different one.

Not via the UI, but you can achieve this with module code to add your own content to the payload sent to Stripe.

use verbb\formie\events\ModifyPaymentPayloadEvent;
use verbb\formie\integrations\payments\Stripe;
use yii\base\Event;

Event::on(Stripe::class, Stripe::EVENT_MODIFY_SUBSCRIPTION_PAYLOAD, function(ModifyPaymentPayloadEvent $event) {
    $event->payload['billing_cycle_anchor'] = '123';
});

engram-design avatar Mar 04 '24 23:03 engram-design