Class: Stripe::Issuing::Authorization

Inherits:
APIResource show all
Extended by:
Gem::Deprecate, APIOperations::List
Includes:
APIOperations::Save
Defined in:
lib/stripe/resources/issuing/authorization.rb

Overview

When an [issued card](docs.stripe.com/issuing) is used to make a purchase, an Issuing ‘Authorization` object is created. [Authorizations](docs.stripe.com/issuing/purchases/authorizations) must be approved for the purchase to be completed successfully.

Related guide: [Issued card authorizations](docs.stripe.com/issuing/purchases/authorizations)

Defined Under Namespace

Classes: AmountDetails, BalanceResponse, CryptoTransaction, Fleet, FraudChallenge, Fuel, MerchantData, NetworkData, PendingRequest, RequestHistory, TestHelpers, TokenDetails, Treasury, VerificationData

Constant Summary collapse

OBJECT_NAME =
"issuing.authorization"

Constants inherited from StripeObject

StripeObject::RESERVED_FIELD_NAMES

Instance Attribute Summary collapse

Attributes inherited from APIResource

#save_with_parent

Attributes inherited from StripeObject

#last_response

Class Method Summary collapse

Instance Method Summary collapse

Methods included from APIOperations::List

list

Methods included from APIOperations::Save

included, #save

Methods inherited from APIResource

class_name, custom_method, #refresh, #request_stripe_object, resource_url, #resource_url, retrieve, save_nested_resource

Methods included from APIOperations::Request

included

Methods inherited from StripeObject

#==, #[], #[]=, #_get_inner_class_type, additive_object_param, additive_object_param?, #as_json, construct_from, #deleted?, #dirty!, #each, #eql?, #hash, #initialize, #inspect, #keys, #marshal_dump, #marshal_load, protected_fields, #serialize_params, #to_hash, #to_json, #to_s, #update_attributes, #values

Constructor Details

This class inherits a constructor from Stripe::StripeObject

Dynamic Method Handling

This class handles dynamic methods through the method_missing method in the class Stripe::StripeObject

Instance Attribute Details

#amountObject (readonly)

The total amount that was authorized or rejected. This amount is in ‘currency` and in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal). `amount` should be the same as `merchant_amount`, unless `currency` and `merchant_currency` are different.



690
691
692
# File 'lib/stripe/resources/issuing/authorization.rb', line 690

def amount
  @amount
end

#amount_detailsObject (readonly)

Detailed breakdown of amount components. These amounts are denominated in ‘currency` and in the [smallest currency unit](docs.stripe.com/currencies#zero-decimal).



692
693
694
# File 'lib/stripe/resources/issuing/authorization.rb', line 692

def amount_details
  @amount_details
end

#approvedObject (readonly)

Whether the authorization has been approved.



694
695
696
# File 'lib/stripe/resources/issuing/authorization.rb', line 694

def approved
  @approved
end

#authorization_methodObject (readonly)

How the card details were provided.



696
697
698
# File 'lib/stripe/resources/issuing/authorization.rb', line 696

def authorization_method
  @authorization_method
end

#balance_responseObject (readonly)

Attribute for field balance_response



698
699
700
# File 'lib/stripe/resources/issuing/authorization.rb', line 698

def balance_response
  @balance_response
end

#balance_transactionsObject (readonly)

List of balance transactions associated with this authorization.



700
701
702
# File 'lib/stripe/resources/issuing/authorization.rb', line 700

def balance_transactions
  @balance_transactions
end

#cardObject (readonly)

You can [create physical or virtual cards](docs.stripe.com/issuing) that are issued to cardholders.



702
703
704
# File 'lib/stripe/resources/issuing/authorization.rb', line 702

def card
  @card
end

#card_presenceObject (readonly)

Whether the card was present at the point of sale for the authorization.



704
705
706
# File 'lib/stripe/resources/issuing/authorization.rb', line 704

def card_presence
  @card_presence
end

#cardholderObject (readonly)

The cardholder to whom this authorization belongs.



706
707
708
# File 'lib/stripe/resources/issuing/authorization.rb', line 706

def cardholder
  @cardholder
end

#createdObject (readonly)

Time at which the object was created. Measured in seconds since the Unix epoch.



708
709
710
# File 'lib/stripe/resources/issuing/authorization.rb', line 708

def created
  @created
end

#crypto_transactionsObject (readonly)

Array of onchain crypto transactions linked to this resource.



710
711
712
# File 'lib/stripe/resources/issuing/authorization.rb', line 710

def crypto_transactions
  @crypto_transactions
end

#currencyObject (readonly)

The currency of the cardholder. This currency can be different from the currency presented at authorization and the ‘merchant_currency` field on this authorization. Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



712
713
714
# File 'lib/stripe/resources/issuing/authorization.rb', line 712

def currency
  @currency
end

#fleetObject (readonly)

Fleet-specific information for authorizations using Fleet cards.



714
715
716
# File 'lib/stripe/resources/issuing/authorization.rb', line 714

def fleet
  @fleet
end

#fraud_challengesObject (readonly)

Fraud challenges sent to the cardholder, if this authorization was declined for fraud risk reasons.



716
717
718
# File 'lib/stripe/resources/issuing/authorization.rb', line 716

def fraud_challenges
  @fraud_challenges
end

#fuelObject (readonly)

Information about fuel that was purchased with this transaction. Typically this information is received from the merchant after the authorization has been approved and the fuel dispensed.



718
719
720
# File 'lib/stripe/resources/issuing/authorization.rb', line 718

def fuel
  @fuel
end

#idObject (readonly)

Unique identifier for the object.



720
721
722
# File 'lib/stripe/resources/issuing/authorization.rb', line 720

def id
  @id
end

#livemodeObject (readonly)

If the object exists in live mode, the value is ‘true`. If the object exists in test mode, the value is `false`.



722
723
724
# File 'lib/stripe/resources/issuing/authorization.rb', line 722

def livemode
  @livemode
end

#merchant_amountObject (readonly)

The total amount that was authorized or rejected. This amount is in the ‘merchant_currency` and in the [smallest currency unit](stripe.com/docs/currencies#zero-decimal). `merchant_amount` should be the same as `amount`, unless `merchant_currency` and `currency` are different.



724
725
726
# File 'lib/stripe/resources/issuing/authorization.rb', line 724

def merchant_amount
  @merchant_amount
end

#merchant_currencyObject (readonly)

The local currency that was presented to the cardholder for the authorization. This currency can be different from the cardholder currency and the ‘currency` field on this authorization. Three-letter [ISO currency code](www.iso.org/iso-4217-currency-codes.html), in lowercase. Must be a [supported currency](stripe.com/docs/currencies).



726
727
728
# File 'lib/stripe/resources/issuing/authorization.rb', line 726

def merchant_currency
  @merchant_currency
end

#merchant_dataObject (readonly)

Attribute for field merchant_data



728
729
730
# File 'lib/stripe/resources/issuing/authorization.rb', line 728

def merchant_data
  @merchant_data
end

#metadataObject (readonly)

Set of [key-value pairs](docs.stripe.com/api/metadata) that you can attach to an object. This can be useful for storing additional information about the object in a structured format.



730
731
732
# File 'lib/stripe/resources/issuing/authorization.rb', line 730

def 
  @metadata
end

#network_dataObject (readonly)

Details about the authorization, such as identifiers, set by the card network.



732
733
734
# File 'lib/stripe/resources/issuing/authorization.rb', line 732

def network_data
  @network_data
end

#objectObject (readonly)

String representing the object’s type. Objects of the same type share the same value.



734
735
736
# File 'lib/stripe/resources/issuing/authorization.rb', line 734

def object
  @object
end

#pending_requestObject (readonly)

The pending authorization request. This field will only be non-null during an ‘issuing_authorization.request` webhook.



736
737
738
# File 'lib/stripe/resources/issuing/authorization.rb', line 736

def pending_request
  @pending_request
end

#request_historyObject (readonly)

History of every time a ‘pending_request` authorization was approved/declined, either by you directly or by Stripe (e.g. based on your spending_controls). If the merchant changes the authorization by performing an incremental authorization, you can look at this field to see the previous requests for the authorization. This field can be helpful in determining why a given authorization was approved/declined.



738
739
740
# File 'lib/stripe/resources/issuing/authorization.rb', line 738

def request_history
  @request_history
end

#statusObject (readonly)

The current status of the authorization in its lifecycle.



740
741
742
# File 'lib/stripe/resources/issuing/authorization.rb', line 740

def status
  @status
end

#tokenObject (readonly)

[Token](docs.stripe.com/api/issuing/tokens/object) object used for this authorization. If a network token was not used for this authorization, this field will be null.



742
743
744
# File 'lib/stripe/resources/issuing/authorization.rb', line 742

def token
  @token
end

#token_detailsObject (readonly)

Attribute for field token_details



744
745
746
# File 'lib/stripe/resources/issuing/authorization.rb', line 744

def token_details
  @token_details
end

#transactionsObject (readonly)

List of [transactions](docs.stripe.com/api/issuing/transactions) associated with this authorization.



746
747
748
# File 'lib/stripe/resources/issuing/authorization.rb', line 746

def transactions
  @transactions
end

#treasuryObject (readonly)

[Treasury](docs.stripe.com/api/treasury) details related to this authorization if it was created on a [FinancialAccount](docs.stripe.com/api/treasury/financial_accounts).



748
749
750
# File 'lib/stripe/resources/issuing/authorization.rb', line 748

def treasury
  @treasury
end

#verification_dataObject (readonly)

Attribute for field verification_data



750
751
752
# File 'lib/stripe/resources/issuing/authorization.rb', line 750

def verification_data
  @verification_data
end

#verified_by_fraud_challengeObject (readonly)

Whether the authorization bypassed fraud risk checks because the cardholder has previously completed a fraud challenge on a similar high-risk authorization from the same merchant.



752
753
754
# File 'lib/stripe/resources/issuing/authorization.rb', line 752

def verified_by_fraud_challenge
  @verified_by_fraud_challenge
end

#walletObject (readonly)

The digital wallet used for this transaction. One of ‘apple_pay`, `google_pay`, or `samsung_pay`. Will populate as `null` when no digital wallet was utilized.



754
755
756
# File 'lib/stripe/resources/issuing/authorization.rb', line 754

def wallet
  @wallet
end

Class Method Details

.approve(authorization, params = {}, opts = {}) ⇒ Object

Deprecated

Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.

This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).



770
771
772
773
774
775
776
777
# File 'lib/stripe/resources/issuing/authorization.rb', line 770

def self.approve(authorization, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(authorization) }),
    params: params,
    opts: opts
  )
end

.decline(authorization, params = {}, opts = {}) ⇒ Object

Deprecated

Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.

This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).



798
799
800
801
802
803
804
805
# File 'lib/stripe/resources/issuing/authorization.rb', line 798

def self.decline(authorization, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(authorization) }),
    params: params,
    opts: opts
  )
end

.field_encodingsObject



995
996
997
998
999
1000
1001
1002
1003
1004
1005
1006
1007
1008
1009
1010
1011
1012
1013
1014
1015
1016
1017
1018
1019
1020
1021
# File 'lib/stripe/resources/issuing/authorization.rb', line 995

def self.field_encodings
  @field_encodings = {
    fleet: {
      kind: :object,
      fields: {
        reported_breakdown: {
          kind: :object,
          fields: {
            fuel: { kind: :object, fields: { gross_amount_decimal: :decimal_string } },
            non_fuel: { kind: :object, fields: { gross_amount_decimal: :decimal_string } },
            tax: {
              kind: :object,
              fields: {
                local_amount_decimal: :decimal_string,
                national_amount_decimal: :decimal_string,
              },
            },
          },
        },
      },
    },
    fuel: {
      kind: :object,
      fields: { quantity_decimal: :decimal_string, unit_cost_decimal: :decimal_string },
    },
  }
end

.field_remappingsObject



991
992
993
# File 'lib/stripe/resources/issuing/authorization.rb', line 991

def self.field_remappings
  @field_remappings = {}
end

.inner_class_typesObject



973
974
975
976
977
978
979
980
981
982
983
984
985
986
987
988
989
# File 'lib/stripe/resources/issuing/authorization.rb', line 973

def self.inner_class_types
  @inner_class_types = {
    amount_details: AmountDetails,
    balance_response: BalanceResponse,
    crypto_transactions: CryptoTransaction,
    fleet: Fleet,
    fraud_challenges: FraudChallenge,
    fuel: Fuel,
    merchant_data: MerchantData,
    network_data: NetworkData,
    pending_request: PendingRequest,
    request_history: RequestHistory,
    token_details: TokenDetails,
    treasury: Treasury,
    verification_data: VerificationData,
  }
end

.list(params = {}, opts = {}) ⇒ Object

Returns a list of Issuing Authorization objects. The objects are sorted in descending order by creation date, with the most recently created object appearing first.



813
814
815
816
817
818
819
820
# File 'lib/stripe/resources/issuing/authorization.rb', line 813

def self.list(params = {}, opts = {})
  request_stripe_object(
    method: :get,
    path: "/v1/issuing/authorizations",
    params: params,
    opts: opts
  )
end

.object_nameObject



17
18
19
# File 'lib/stripe/resources/issuing/authorization.rb', line 17

def self.object_name
  "issuing.authorization"
end

.update(authorization, params = {}, opts = {}) ⇒ Object

Updates the specified Issuing Authorization object by setting the values of the parameters passed. Any parameters not provided will be left unchanged.



823
824
825
826
827
828
829
830
# File 'lib/stripe/resources/issuing/authorization.rb', line 823

def self.update(authorization, params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/issuing/authorizations/%<authorization>s", { authorization: CGI.escape(authorization) }),
    params: params,
    opts: opts
  )
end

Instance Method Details

#approve(params = {}, opts = {}) ⇒ Object

Deprecated

Approves a pending Issuing Authorization object. This request should be made within the timeout window of the [real-time authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.

This method is deprecated. Instead, [respond directly to the webhook request to approve an authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).



758
759
760
761
762
763
764
765
# File 'lib/stripe/resources/issuing/authorization.rb', line 758

def approve(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/issuing/authorizations/%<authorization>s/approve", { authorization: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#decline(params = {}, opts = {}) ⇒ Object

Deprecated

Declines a pending Issuing Authorization object. This request should be made within the timeout window of the [real time authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations) flow.

This method is deprecated. Instead, [respond directly to the webhook request to decline an authorization](docs.stripe.com/docs/issuing/controls/real-time-authorizations#authorization-handling).



786
787
788
789
790
791
792
793
# File 'lib/stripe/resources/issuing/authorization.rb', line 786

def decline(params = {}, opts = {})
  request_stripe_object(
    method: :post,
    path: format("/v1/issuing/authorizations/%<authorization>s/decline", { authorization: CGI.escape(self["id"]) }),
    params: params,
    opts: opts
  )
end

#test_helpersObject



832
833
834
# File 'lib/stripe/resources/issuing/authorization.rb', line 832

def test_helpers
  TestHelpers.new(self)
end