Update payment method request with email.

This commit is contained in:
Alex Hart
2021-11-17 16:35:43 -04:00
committed by Cody Henthorne
parent 8aea20f147
commit 14aecc4684
2 changed files with 10 additions and 5 deletions

View File

@@ -96,11 +96,16 @@ class StripeApi(
private fun createPaymentMethod(paymentSource: PaymentSource): Response {
val tokenizationData = paymentSource.parameterize()
val parameters = mapOf(
val parameters = mutableMapOf(
"card[token]" to JSONObject((tokenizationData.get("token") as String).replace("\n", "")).getString("id"),
"type" to "card"
"type" to "card",
)
val email = paymentSource.email()
if (email != null) {
parameters["billing_details[email]"] = email
}
return postForm("payment_methods", parameters)
}