A PaymentMethod resource describes which payment method was used to fulfill a payment. It is used with a PaymentIntent to collect payments.

A PaymentMethod Resource

{
    "data": {
        "id": "pm_ajeDG2y6WgnrCXaamWFmPUw2",
        "type": "payment_method",
        "attributes": {
            "billing": {
                "address": {
                    "city": "Taguig",
                    "country": "PH",
                    "line1": "Unit 3308, High St South Corp Plaza",
                    "line2": "26th Street & 11th Avenue",
                    "postal_code": "1634",
                    "state": "Metro Manila"
                },
                "email": "[email protected]",
                "name": "Juan Dela Cruz",
                "phone": "63288881111"
            },
            "details": {
                "last4": "4242",
                "exp_month": 1,
                "exp_year": 24
            },
            "livemode": false,
            "type": "card",
            "metadata": {
                "sample": "123"
            },
            "created_at": 1586097138,
            "updated_at": 1586097138
        }
    }
}

id string
Unique ID of the resource.


type string
Represents the resource type. Value is always payment_method.


billing dictionary

AttributeDescription
address.city stringCity of the billing address information
address.country stringCountry of the billing address information. Possible values are ISO 3166-1 alpha-2 codes or two-letter country codes..
address.line1 stringLine1 of the billing address information
address.line2 stringLine2 of the billing address information
address.postal_code stringPostal Code of the billing address information
address.state stringState of the billing address information
email stringE-mail address of the billing information.
name stringName of the billing information.
phone stringPhone of the billing information.

details dictionary
The attributes of details vary based on the type of payment method. The example below is for card payment method.

AttributeDescription
last4 stringThe last 4 digits of the credit card.
exp_month integerExpiry month of the credit card.
exp_year integerExpiry year of the credit card.

livemode boolean
The value is true if the resource exists in live mode or the value is false if the resource exists in test mode.


attributes.type string
The type of payment method. The possible values are card and paymaya for now.


metadata dictionary
A set of key-value pairs that you can attach to the resource. This can be useful for storing additional information about the object in a structured format. Only string values are accepted.


created_at timestamp
The timestamp when the payment method has been created.


updated_at timestamp
The timestamp when the payment method has been updated.