支付优化调整
This commit is contained in:
parent
24df252924
commit
788822db37
|
@ -49,10 +49,12 @@ func (stripePay *Stripe) GeneratePrepayment(req *GeneratePrepaymentReq) (res *Ge
|
|||
case "session":
|
||||
// session 方式
|
||||
params := &stripe.CheckoutSessionParams{
|
||||
// PaymentIntentData: &stripe.CheckoutSessionPaymentIntentDataParams{Metadata: req.Metadata},
|
||||
PaymentMethodTypes: stripe.StringSlice([]string{
|
||||
"card",
|
||||
// "ideal",
|
||||
}),
|
||||
Metadata: req.Metadata,
|
||||
LineItems: []*stripe.CheckoutSessionLineItemParams{
|
||||
{
|
||||
PriceData: &stripe.CheckoutSessionLineItemPriceDataParams{
|
||||
|
@ -67,9 +69,9 @@ func (stripePay *Stripe) GeneratePrepayment(req *GeneratePrepaymentReq) (res *Ge
|
|||
SuccessURL: stripe.String(req.SuccessURL),
|
||||
CancelURL: stripe.String(req.CancelURL),
|
||||
}
|
||||
for key, item := range req.Metadata {
|
||||
params.AddMetadata(key, item)
|
||||
}
|
||||
// for key, item := range req.Metadata {
|
||||
// params.AddMetadata(key, item)
|
||||
// }
|
||||
resCheckoutSession, err := session.New(params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
@ -79,16 +81,17 @@ func (stripePay *Stripe) GeneratePrepayment(req *GeneratePrepaymentReq) (res *Ge
|
|||
case "intent":
|
||||
// 密钥方式
|
||||
params := &stripe.PaymentIntentParams{
|
||||
Amount: stripe.Int64(req.Amount),
|
||||
Currency: stripe.String(string(req.Currency)),
|
||||
PaymentMethodTypes: stripe.StringSlice([]string{
|
||||
"card",
|
||||
// "ideal",
|
||||
}),
|
||||
Metadata: req.Metadata,
|
||||
Amount: stripe.Int64(req.Amount),
|
||||
Currency: stripe.String(string(req.Currency)),
|
||||
}
|
||||
for key, item := range req.Metadata {
|
||||
params.AddMetadata(key, item)
|
||||
}
|
||||
// for key, item := range req.Metadata {
|
||||
// params.AddMetadata(key, item)
|
||||
// }
|
||||
resPaymentintent, err := paymentintent.New(params)
|
||||
if err != nil {
|
||||
return nil, err
|
||||
|
|
Loading…
Reference in New Issue
Block a user