Problem/Motivation

This task is part of the meta issue for supporting onsite gateways/stored payments methods (See #3162190: [META] Support onsite payment gateways / stored payment methods).

We currently don't return the available payment options which means the frontend isn't aware of the payment methods available for paying an order.

We should probably first focus on returning the available reusable stored payment methods, and worry about returning the available "new" payment options in a followup since we're currently focusing on supporting payments via stored payment methods.

Support from Acquia helps fund testing for Drupal Acquia logo

Comments

jsacksick created an issue. See original summary.

jsacksick’s picture

Status: Active » Needs review
FileSize
11.74 KB

@mglaman: I still think it's good to "split" the work into small chunks (to make it easier for commits). Nothing is preventing us to make changes once it's committed assuming we don't tag a release.

I think it's fine to just return the payment options as is...

jsacksick’s picture

jsacksick’s picture

FileSize
1.14 KB
jsacksick’s picture

The bump to Commerce 2.x dev is required because of #3163464: Add a PaymentOption::toArray() method.

  • jsacksick committed cf42afe on 8.x-1.x
    Issue #3162349 by jsacksick: Return the available payment options via...
jsacksick’s picture

Status: Needs review » Fixed

Committed, there's a possibility the payment option "id" will be removed before the release though...

jsacksick’s picture

Attaching a sample "payload":

"payment_options": [
    {
        "id": "new--credit_card--braintree",
        "label": "Credit card (Braintree)",
        "payment_gateway_id": "braintree",
        "payment_method_id": null,
        "payment_method_type_id": "credit_card"
    },
    {
        "id": "new--paypal--braintree",
        "label": "PayPal",
        "payment_gateway_id": "braintree",
        "payment_method_id": null,
        "payment_method_type_id": "paypal"
    },
    {
        "id": "new--paypal_credit--braintree",
        "label": "New PayPal Credit",
        "payment_gateway_id": "braintree",
        "payment_method_id": null,
        "payment_method_type_id": "paypal_credit"
    },
    {
        "id": "new--credit_card--example_credit_card",
        "label": "Credit card (Example)",
        "payment_gateway_id": "example_credit_card",
        "payment_method_id": null,
        "payment_method_type_id": "credit_card"
    },
    {
        "id": "cash_on_delivery",
        "label": "Cash on delivery",
        "payment_gateway_id": "cash_on_delivery",
        "payment_method_id": null,
        "payment_method_type_id": null
    },
    {
        "id": "klarna",
        "label": "Klarna Checkout",
        "payment_gateway_id": "klarna",
        "payment_method_id": null,
        "payment_method_type_id": null
    }
]

Status: Fixed » Closed (fixed)

Automatically closed - issue fixed for 2 weeks with no activity.

mglaman’s picture