STPAPIResponseDecodable

@protocol STPAPIResponseDecodable <NSObject>

Objects conforming to STPAPIResponseDecodable can be automatically converted from a JSON dictionary that was returned from the Stripe API.

  • Parses an response from the Stripe API (in JSON format; represented as an NSDictionary) into an instance of the class.

    Declaration

    Objective-C

    + (nullable instancetype)decodedObjectFromAPIResponse:
        (nullable NSDictionary *)response;

    Swift

    static func decodedObject(fromAPIResponse response: [AnyHashable : Any]?) -> Self?

    Parameters

    response

    The JSON dictionary that represents an object of this type

    Return Value

    The object represented by the JSON dictionary, or nil if the object could not be decoded (i.e. if one of its requiredFields is nil).

  • The raw JSON response used to create the object. This can be useful for accessing fields that haven’t yet been made into native properties in the SDK.

    Declaration

    Objective-C

    @property (readonly, copy, nonatomic, nonnull) NSDictionary *allResponseFields;

    Swift

    var allResponseFields: [AnyHashable : Any] { get }