@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.js CHANGED
@@ -165,13 +165,20 @@ var ReevitAPIClient = class {
165
165
  * Creates a payment intent
166
166
  */
167
167
  async createPaymentIntent(config, method, country = "GH") {
168
+ const metadata = { ...config.metadata };
169
+ if (config.email) {
170
+ metadata.customer_email = config.email;
171
+ }
172
+ if (config.phone) {
173
+ metadata.customer_phone = config.phone;
174
+ }
168
175
  const request = {
169
176
  amount: config.amount,
170
177
  currency: config.currency,
171
178
  method: this.mapPaymentMethod(method),
172
179
  country,
173
- customer_id: config.metadata?.customerId,
174
- metadata: config.metadata
180
+ customer_id: config.email || config.metadata?.customerId,
181
+ metadata
175
182
  };
176
183
  return this.request("POST", "/v1/payments/intents", request);
177
184
  }