Hello @trehulka,
If you can, check github (only the files include/functions.php and include/create_payment.php were updated) version of the plugin.
I added a button_id argument for the shortcode (button_id=”1″) and the $chargeID and $button_id as parameters for the actions ‘direct_stripe_before_success_redirection’ and ‘direct_stripe_before_error_redirection’.
With that you could add an action in your (child-)theme’s functions.php file to add metadata, like so :
function my_direct_stripe_action($chargeID, $post_id, $button_id) {
if( $button_id === '1') {
$ch = \Stripe\Charge::retrieve($chargeID);
$ch->metadata[my_key]=my_var;
$ch->save();
}
}
add_action( 'direct_stripe_before_success_redirection', 'my_direct_stripe_action', 10, 3 );
Of couse you would have to find your best way to retrieve and make ‘my_var’ the precise or random data you need per payment.
Cheers!
Nicolas