NAME

Net::API::Stripe::Exception - Stripe Exception

SYNOPSIS

use Net::API::Stripe::Exception;
my $err = Net::API::Stripe::Exception->new( $error_message ) || 
    die( Net::API::Stripe::Exception->error, "\n" );
# or
my $err = Net::API::Stripe::Exception->new({
    code => 'resource_missing',
    doc_url => 'https://stripe.com/docs/error-codes/resource-missing',
    message => $error_message,
    param => 'payment_method',
    request_log_url => '//dashboard.stripe.com/test/logs/req_123456789qwerty?t=1673383344',
    type => 'invalid_request_error',
}) || die( Net::API::Stripe::Exception->error, "\n" );

VERSION

v0.1.0

DESCRIPTION

This class inherits all its methods from Module::Generic::Exception

METHODS

Please see Module::Generic::Exception for details.

charge

String. For card errors, sets or gets the ID of the failed charge.

code

String. Sets or gets the Stripe error code. See for more details of what they are: https://stripe.com/docs/error-codes

decline_code

String. Sets or gets a short string for card errors resulting from a card issuer decline. This is a short string indicating the card issuer’s reason for the decline if they provide one.

doc_url

URI. Sets or gets the url of the Stripe documentation detailing that error code. For example: https://stripe.com/docs/error-codes/resource-missing

http_code

The HTTP status code returned by Stripe. For example 200 or 400

200 - OK

Everything worked as expected.

400 - Bad Request

The request was unacceptable, often due to missing a required parameter.

401 - Unauthorised

No valid API key provided.

402 - Request Failed

The parameters were valid but the request failed.

403 - Forbidden

The API key doesn't have permissions to perform the request.

404 - Not Found

The requested resource doesn't exist.

409 - Conflict

The request conflicts with another request (perhaps due to using the same idempotent key).

429 - Too Many Requests

Too many requests hit the API too quickly. We recommend an exponential backoff of your requests.

500, 502, 503, 504 - Server Errors

Something went wrong on Stripe's end. (These are rare.)

See: https://stripe.com/docs/api/errors

http_headers

The HTTP headers object from the Stripe HTTP response.

message

String. Sets or gets the Stripe error message.

param

String. Sets or gets the error param. For example: payment_method

If the error is parameter-specific, the parameter related to the error. For example, you can use this to display a message near the correct form field.

payment_intent

Sets or gets the PaymentIntent object for errors returned on a request involving a PaymentIntent.

payment_method

Sets or gets the PaymentMethod object for errors returned on a request involving a PaymentMethod.

payment_method_type

String. If the error is specific to the type of payment method, sets or gets the payment method type that had a problem. This field is only populated for invoice-related errors.

request_log_url

The uri in the dashboard to get details about the error that occurred.

setup_intent

Sets or gets the SetupIntent object for errors returned on a request involving a SetupIntent.

source

Sets or gets the source object for errors returned on a request involving a source.

type

String. Sets or gets the type of error returned. One of the following:

  • api_error

    API errors cover any other type of problem (e.g., a temporary problem with Stripe's servers), and are extremely uncommon.

  • card_error

    Card errors are the most common type of error you should expect to handle. They result when the user enters a card that cannot be charged for some reason.

  • idempotency_error

    Idempotency errors occur when an Idempotency-Key is re-used on a request that does not match the first request's API endpoint and parameters.

  • invalid_request_error

    Invalid request errors arise when your request has invalid parameters.

AUTHOR

Jacques Deguest <jack@deguest.jp>

SEE ALSO

Module::Generic::Exception

Net::API::Stripe

https://stripe.com/docs/api/errors, https://stripe.com/docs/error-codes

COPYRIGHT & LICENSE

Copyright(c) 2022 DEGUEST Pte. Ltd.

All rights reserved.

This program is free software; you can redistribute it and/or modify it under the same terms as Perl itself.