#DaanVDH
1 messages · Page 1 of 1 (latest)
Do all of these support hooks?
Webhooks?
Yes
Yeah they do. Under the hood they use all the same Stripe objects
I'm having a bit of trouble because for every other payment method type I'm creating the payment method on the server and then create an intent with that payment method and if successful send the redirect URL to the client side to confirm their payment. But if i want to do that for cards is need to fill in the SAQ D,
is there a way to create a payment method without prefilling the card information and creating a redirect URL like you do with all the other payment method types?
I don't want to change the whole payment flow only for card payments
I'm a bit confused on your flow. If you use one of the hosted solutions, there's no need to create a Payment Method explicitly. Your customer checking out will have that done for them automatically
I'm not using any of the hosted solutions right now, I'm doing it on my server.
go
switch method {
case Card:
params := &stripe.PaymentMethodParams{
Card: &stripe.PaymentMethodCardParams{
Number: stripe.String(fmt.Sprintf("%v", cardParams.CardNumber)),
ExpMonth: stripe.String(fmt.Sprintf("%v", cardParams.ExpireMonth)),
ExpYear: stripe.String(fmt.Sprintf("%v", cardParams.ExpireYear)),
CVC: stripe.String(fmt.Sprintf("%v", cardParams.CVC)),
},
Type: stripe.String("card"),
BillingDetails: &stripe.BillingDetailsParams{
Address: &stripe.AddressParams{
City: stripe.String(order.BillingInfo.City),
Country: stripe.String(order.BillingInfo.Country),
Line1: stripe.String(fmt.Sprintf("%v %v", order.BillingInfo.Street, order.BillingInfo.HouseNumber)),
PostalCode: stripe.String(order.BillingInfo.PostalCode),
State: stripe.String(order.BillingInfo.State),
},
Email: stripe.String(order.OrderEmail),
Name: stripe.String(fmt.Sprintf("%v %v", order.BillingInfo.FirstName, order.BillingInfo.LastName)),
Phone: stripe.String(fmt.Sprintf("%v", order.BillingInfo.PhoneNumber)),
},
}
params.SetStripeAccount(accountId)
pm, err := paymentmethod.New(params)
if err != nil {
return nil, err
}
return pm, nil
this is the example for a card payment right now
Gotcha. Creating a PM server-side first is not the recommended flow. This is more what we recommend: https://stripe.com/docs/payments/accept-a-payment?platform=web&ui=elements