impress-org / givewp-snippet-library

A collection of code snippets to enhance or expand on the free Give WordPress Donation Plugin.
https://givewp.com
140 stars 90 forks source link

fix: update snippet for passing custom metadata to Stripe payments #98

Closed samsmith89 closed 5 years ago

samsmith89 commented 5 years ago

Bug Report

User Story

As a developer, I want to pass additional information from the form to the metadata for Stripe payments so that I can provide users with more information for better organization at the payment gateway.

Example: I would like to pass the donation comment in the forms to the Stripe metadata section of the payment.

Here is a link to the code snippet: https://github.com/impress-org/give-snippet-library/blob/62b821170e30a4aaf229b18faf4fbee7f84c95e6/gateway-customizations/stripe-pass-custom-meta-for-payments.php

Current Behavior

Currently, there is no filter on the "prepare_metadata" function within the addon files

Expected Behavior

I expect this function to be filterable so I can extend the Stripe addon functionality.

Bug Type

Possible Solution

Making the "prepare_metadata" function filterable here: https://github.com/impress-org/give-stripe/blob/986dfef067d2c9daf457ed2e12848dc9b66ccad2/includes/class-give-stripe-gateway.php#L643

Related

https://secure.helpscout.net/conversation/800742754/35972

Acceptance Criteria

captainhook commented 5 years ago

What is the format for custom fields? For example if I add a field name 'fund' using Form Field Manager, what meta key I take from $posted_data?