Twilio集成Stripe连接器:使用Pay动词传递额外信息的方法
问题描述
我已在Twilio系统中配置Stripe连接器,并在控制器中调用Pay功能。目前仅能通过Stripe支付条目的description字段传递信息,现需实现两个需求:
- 用来电者电话号码更新Stripe的
customer字段 - 传递与数据库表条目关联的GUID,使其出现在监听的Stripe Webhook(如
payment_intent.succeeded/payment.charged等)中,例如更新metadata属性
我已花费大量时间研究但未找到方案,若无法实现则只能复用description字段后续修改。以下是我的代码:
[HttpPost] public IActionResult TakeStripePayment(PaymentId id, VoiceRequest request) { var response = new VoiceResponse(); var payment = (from p in _DbContext.Payment where p.Id == id select p).Single(); var subMeter = (from p in _DbContext.SMPSupplyMeter where p.Id == payment.SMPSupplyMeterId select p.SubMeter).Single(); var meterNo = ShortMeterNo(subMeter.Serial.ToString()); response.Say("You will now be asked to enter your card details. After entering digits, press the hash key to move on to the next question."); var pay = new Pay(paymentConnector: _config.PaymentConnector.ToString(), description: PaymentUtility.GetDescriptionForPaymentGateway(payment) + $" {request.From}", timeout: 15, currency: "gbp", chargeAmount: $"{Math.Round(payment.Amount.Value)}", postalCode: "false", action: new Uri($"/voice/AfterPay?id={payment.Id}", UriKind.Relative)); // something here to send the number and GUID? e.g. pay.SetOption() or pay.Parameter()? Example? var prompt = new Twilio.TwiML.Voice.Prompt(for_: Twilio.TwiML.Voice.Prompt.ForEnum.PaymentCardNumber).Say("Please enter long card number."); pay.Append(prompt); prompt = new Twilio.TwiML.Voice.Prompt(for_: Twilio.TwiML.Voice.Prompt.ForEnum.ExpirationDate).Say("Please enter the expiration date as 4 digits."); pay.Append(prompt); prompt = new Twilio.TwiML.Voice.Prompt(for_: Twilio.TwiML.Voice.Prompt.ForEnum.SecurityCode).Say("Please enter the three security digits on the back of the card."); pay.Append(prompt); prompt = new Twilio.TwiML.Voice.Prompt(for_: Twilio.TwiML.Voice.Prompt.ForEnum.PaymentProcessing); pay.Append(prompt); response.Append(pay); return TwiML(response); }
请问是否有实现上述需求的方法示例?
内容的提问来源于stack exchange,提问作者Rabbi Kaii
相关产品推荐
相关产品推荐

