@reevit/react 0.2.4 → 0.2.5

This diff represents the content of publicly available package versions that have been released to one of the supported registries. The information contained in this diff is provided for informational purposes only and reflects changes between package versions as they appear in their respective public registries.
package/dist/index.mjs CHANGED
@@ -163,13 +163,20 @@ var ReevitAPIClient = class {
163
163
  * Creates a payment intent
164
164
  */
165
165
  async createPaymentIntent(config, method, country = "GH") {
166
+ const metadata = { ...config.metadata };
167
+ if (config.email) {
168
+ metadata.customer_email = config.email;
169
+ }
170
+ if (config.phone) {
171
+ metadata.customer_phone = config.phone;
172
+ }
166
173
  const request = {
167
174
  amount: config.amount,
168
175
  currency: config.currency,
169
176
  method: this.mapPaymentMethod(method),
170
177
  country,
171
- customer_id: config.metadata?.customerId,
172
- metadata: config.metadata
178
+ customer_id: config.email || config.metadata?.customerId,
179
+ metadata
173
180
  };
174
181
  return this.request("POST", "/v1/payments/intents", request);
175
182
  }