Skip to content

Catching errors rather than an exception #12

@normal1ze

Description

@normal1ze

With your example:

charge = PinPayment::Charge.create(
customer: customer, # or you can pass customer.token, either way
email: customer.email,
amount: 1000,
currency: 'USD', # only AUD and USD are supported by pin.net.au
description: 'Widgets',
ip_address: request.remote_ip
)

if charge.success?

You would now store charge.token as a reference for this payment

end

Is there a way to return an error say "charge.errors" rather than raising an exception. With your example if the card returns an "Insaficiant funds" error it raises it as an exception. Would be awesome to have that as a return of charge.

Cheers. Ian

Metadata

Metadata

Assignees

No one assigned

    Labels

    No labels
    No labels

    Projects

    No projects

    Milestone

    No milestone

    Relationships

    None yet

    Development

    No branches or pull requests

    Issue actions