Setting payment method to cart with Magento API

Setting payment method to cart with Magento API

October 18, 2026 · Illustrated author avatarBy Stefan Bogdanescu
Setting payment method to cart with Magento API

Setting Up PayPal Payment Method for Magento Orders via API

Are you facing issues while trying to set up payment methods using Magento API? Let’s dive into a common scenario where the “Payment method is not allowed” error occurs when attempting to add a PayPal payment to your cart.

Understanding the Issue

The core problem lies in how Magento handles and stores configuration settings for various payment methods. When you enable the PayPal Standard option under System > Configuration, it doesn’t automatically create an active payment method that can be associated with orders via API.

Additionally, when calling the cart_payment.list method, you might receive an empty array because no payment methods are currently configured or activated in the system.

Diagnosing the Problem

To better understand this issue, let’s examine the relevant code snippet and analyze the error message:

$paymentMethod = array(
    "method" => "paypal_standard"
);

$resultPaymentMethod = $proxy->call(
    $sessionId,
    "cart_payment.method",
    array(
        $shoppingCartId,
        $paymentMethod
    )
);

The error you’re encountering—“Payment method is not allowed”—indicates that the PayPal payment method hasn’t been properly configured within your Magento installation. Even though you’ve enabled PayPal Standard in the admin panel, it doesn’t automatically register as a valid option for order creation via API.

Resolving the Payment Method Setup

To fix this issue and successfully create orders with PayPal payment:

Step 1: Enable the PayPal Payment Method Manually

Navigate to System > Configuration > Sales > Payment Methods in your Magento admin interface. Click on the “Add New” button, search for “PayPal Standard,” and click “Select.”

Configure the necessary settings, such as API credentials, currency, payment action, etc., then save the new method.

Step 2: Activate the PayPal Method

With the newly created payment method visible in the list of active methods, ensure that you check the box next to it to enable it for your website. Save your configuration changes.

Step 3: Add the Payment Method to Your API Calls

After activating the PayPal Standard method in the admin interface, you should be able to associate it with a shopping cart via API without encountering the “Payment method is not allowed” error:

$paymentMethod = array(
    "method" => "paypal_standard"
);

$resultPaymentMethod = $proxy->call(
    $sessionId,
    "cart_payment.method",
    array(
        $shoppingCartId,
        $paymentMethod
    )
);

Conclusion

Setting up payment methods for Magento orders via API can be a complex process, especially when dealing with third-party payment gateways like PayPal. The key to resolving this issue lies in manually enabling and activating the desired payment method within your Magento admin interface before attempting to associate it with orders through the API.

Remember that properly configuring your payment gateway settings is crucial for successful order processing and avoiding errors during API communication.

For more detailed information on Magento API integration best practices, you can refer to our comprehensive guide on Setting Up Payment Methods in Magento.

Checkout API Admin Configuration

Our network