Getting more info abount transaction ad move js partial to js file
This commit is contained in:
		@ -3,6 +3,7 @@ package cards
 | 
			
		||||
import (
 | 
			
		||||
	"github.com/stripe/stripe-go/v79"
 | 
			
		||||
	"github.com/stripe/stripe-go/v79/paymentintent"
 | 
			
		||||
	"github.com/stripe/stripe-go/v79/paymentmethod"
 | 
			
		||||
)
 | 
			
		||||
 | 
			
		||||
type Card struct {
 | 
			
		||||
@ -48,6 +49,28 @@ func (c *Card) CreatePaymentIntent(
 | 
			
		||||
	return pi, "", nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// GetPaymentMethod gets the payment method by payment intend id
 | 
			
		||||
func (c *Card) GetPaymentMethod(s string) (*stripe.PaymentMethod, error) {
 | 
			
		||||
	stripe.Key = c.Secret
 | 
			
		||||
 | 
			
		||||
	pm, err := paymentmethod.Get(s, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return pm, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
// RetrievePaymentMethod gets an existing payment intent by id
 | 
			
		||||
func (c *Card) RetrievePaymentIntent(id string) (*stripe.PaymentIntent, error) {
 | 
			
		||||
	stripe.Key = c.Secret
 | 
			
		||||
 | 
			
		||||
	pi, err := paymentintent.Get(id, nil)
 | 
			
		||||
	if err != nil {
 | 
			
		||||
		return nil, err
 | 
			
		||||
	}
 | 
			
		||||
	return pi, nil
 | 
			
		||||
}
 | 
			
		||||
 | 
			
		||||
func cardErrorMessage(code stripe.ErrorCode) string {
 | 
			
		||||
	msg := ""
 | 
			
		||||
 | 
			
		||||
 | 
			
		||||
		Reference in New Issue
	
	Block a user