GithubHelp home page GithubHelp logo

Brooklyn about accept-a-payment HOT 3 CLOSED

stripe-samples avatar stripe-samples commented on July 17, 2024
Brooklyn

from accept-a-payment.

Comments (3)

liny13415 avatar liny13415 commented on July 17, 2024

🙈

from accept-a-payment.

liny13415 avatar liny13415 commented on July 17, 2024

_, err := // Go library call

if err != nil {
// Try to safely cast a generic error to a stripe.Error so that we can get at
// some additional Stripe-specific information about what went wrong.
if stripeErr, ok := err.(*stripe.Error); ok {
// The Code field will contain a basic identifier for the failure.
switch stripeErr.Code {
case stripe.ErrorCodeCardDeclined:
case stripe.ErrorCodeExpiredCard:
case stripe.ErrorCodeIncorrectCVC:
case stripe.ErrorCodeIncorrectZip:
// etc.
}

// The Err field can be coerced to a more specific error type with a type
// assertion. This technique can be used to get more specialized
// information for certain errors.
if cardErr, ok := stripeErr.Err.(*stripe.CardError); ok {
  fmt.Printf("Card was declined with code: %v\n", cardErr.DeclineCode)
} else {
  fmt.Printf("Other Stripe error occurred: %v\n", stripeErr.Error())
}

} else {
fmt.Printf("Other error occurred: %v\n", err.Error())
}
}

from accept-a-payment.

cjavilla-stripe avatar cjavilla-stripe commented on July 17, 2024

Can you add some more context? Not sure what the issue is here.

from accept-a-payment.

Related Issues (20)

Recommend Projects

  • React photo React

    A declarative, efficient, and flexible JavaScript library for building user interfaces.

  • Vue.js photo Vue.js

    🖖 Vue.js is a progressive, incrementally-adoptable JavaScript framework for building UI on the web.

  • Typescript photo Typescript

    TypeScript is a superset of JavaScript that compiles to clean JavaScript output.

  • TensorFlow photo TensorFlow

    An Open Source Machine Learning Framework for Everyone

  • Django photo Django

    The Web framework for perfectionists with deadlines.

  • D3 photo D3

    Bring data to life with SVG, Canvas and HTML. 📊📈🎉

Recommend Topics

  • javascript

    JavaScript (JS) is a lightweight interpreted programming language with first-class functions.

  • web

    Some thing interesting about web. New door for the world.

  • server

    A server is a program made to process requests and deliver data to clients.

  • Machine learning

    Machine learning is a way of modeling and interpreting data that allows a piece of software to respond intelligently.

  • Game

    Some thing interesting about game, make everyone happy.

Recommend Org

  • Facebook photo Facebook

    We are working to build community through open source technology. NB: members must have two-factor auth.

  • Microsoft photo Microsoft

    Open source projects and samples from Microsoft.

  • Google photo Google

    Google ❤️ Open Source for everyone.

  • D3 photo D3

    Data-Driven Documents codes.