Currently we have two magento independent websites. One is behaving as storefront and other as back end. User can place the order at front end.

So same order I am trying to create programmatically at back end. When user pay through checkmo payment method it works. But when user pays through PayPal it is not working. So anybody knows how we can create order programmatically using PayPal payment methods? Is it possible or not?

$quote->getPayment()->importData(array(3) {
    [method] => paypal_express
    [last_trans_id] => 65Y31421KL2753028
    [additional_information] => Array
        [paypal_express_checkout_shipping_method] => 
        [paypal_payer_id] => 5LX84SUFY39L4
        [paypal_payer_email] => [email protected]
        [paypal_payer_status] => verified
        [paypal_address_status] => Confirmed
        [paypal_correlation_id] => b78b4e5e6e527
        [paypal_express_checkout_payer_id] => 5LX84SUFY39L4
        [paypal_express_checkout_token] => EC-7P402752023166448
        [paypal_express_checkout_redirect_required] => 
        [paypal_protection_eligibility] => Eligible
        [paypal_payment_status] => pending
        [paypal_pending_reason] => authorization

Error: PayPal gateway has rejected request. A successful transaction has already been completed for this token (#10415: Transaction refused because of an invalid argument. See additional error messages for details).


2 Answers 2


Creating an order with the actual PayPal payment method is not possible, since you'll need to do an actual payment. That is why PayPal is rejecting the request; you'll also need to send a token (to initiate the request) to PayPal so they can verify it.

Since you don't actually need a second payment but need it for record-keeping (as far as I can read) it might be wise to create a fake PayPal payment method for the other Magento instance and set that as a payment method when transferring the order.

As Inchoo already explained this in detail (it's not as hard as it sounds since you'll only need to implement the Magento part) I won't copy/paste it here but only give you the link; http://inchoo.net/magento/how-to-create-magento-payment-module/

Just call it 'paypal_proxy_payment' or something and use that method and you're good to go!


I am sharing one link in my answer and please go through it and just copy paste the code in your custom controller then you have to change the payment method


$this->orderData = array(
    'session'       => array(
        'customer_id'   => $this->_sourceCustomer->getId(),
        'store_id'      => $this->_storeId,
    'payment'       => array(
        'method'    => 'checkmo',

instead of checkmo you can write your payment method.

Please check this out.

Your Answer

By clicking “Post Your Answer”, you agree to our terms of service and acknowledge you have read our privacy policy.

Not the answer you're looking for? Browse other questions tagged or ask your own question.