How to transfer back money by PayPalExpress (not backend)?
Forum rules
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
Always add your Aimeos and PHP version as well as your environment (Linux/Mac/Win)
Spam and unrelated posts will be removed immediately!
How to transfer back money by PayPalExpress (not backend)?
Hi,
is performing refunds still only possible in the admin backend (see attached screenshot, transaction view) or is there in the meantime a way to process it via a php controller?
I've created an user restricted area where frontend users can create and edit events which are synchronised with the aimeos products. Now they should be able to cancel orders.
I managed to change the status of an order for the refund and an email (same as from the backend) is sent to the customer which informs him about the refund, but I didn't yet manage to automatically transfer money back to his paypal account like it can be done in the backend (see attached screenshot).
At the moment I'm testing with the paypal sandbox.
This is my code at the moment:
What's the best way to start the process for the money transaction?
Aimeos: 24.4.2
TYPO3: 12.4.25
Thank you for any hint!
is performing refunds still only possible in the admin backend (see attached screenshot, transaction view) or is there in the meantime a way to process it via a php controller?
I've created an user restricted area where frontend users can create and edit events which are synchronised with the aimeos products. Now they should be able to cancel orders.
I managed to change the status of an order for the refund and an email (same as from the backend) is sent to the customer which informs him about the refund, but I didn't yet manage to automatically transfer money back to his paypal account like it can be done in the backend (see attached screenshot).
At the moment I'm testing with the paypal sandbox.
This is my code at the moment:
Code: Select all
/**
* Action refund
* @param integer id
*
* @return void
*/
public function cancelProductAction( $id ): void {
$config = Base::config((array) $this->settings);
$context = \Aimeos\Aimeos\Base::context($config);
$orderManager = MShop::create($context, 'order');
$order = $orderManager->get( $id );
$status = \Aimeos\MShop\Order\Item\Base::PAY_REFUND;
$order->setStatusPayment( $status );
$orderManager->save( $order );
}
Aimeos: 24.4.2
TYPO3: 12.4.25
Thank you for any hint!
- Attachments
-
- screenshot-www.aimeos.ddev.site-2025.01.22-22_18_20.png (30.58 KiB) Viewed 549 times
Re: How to transfer back money by PayPalExpress (not backend)?
Here you can see the API calls for a refund:
https://github.com/aimeos/ai-admin-jqad ... #L221-L255
https://github.com/aimeos/ai-admin-jqad ... #L221-L255
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star
Re: How to transfer back money by PayPalExpress (not backend)?
Thank you very much!
It works now
The only things now, which also happens when refunding by the backend:
The customer is receiving again the original invoice in the email and in the attached pdf and not something like a credit note (in german: Gutschrift, e.g. with negative values). Have I perhaps overlooked something?
And the email subject is still the same. But I think I can change this easily in the template.
It works now
The only things now, which also happens when refunding by the backend:
The customer is receiving again the original invoice in the email and in the attached pdf and not something like a credit note (in german: Gutschrift, e.g. with negative values). Have I perhaps overlooked something?
And the email subject is still the same. But I think I can change this easily in the template.
Re: How to transfer back money by PayPalExpress (not backend)?
PS: I have also now noticed that partial refunds do not work. PayPal Express always transfers the entire amount back. Is this perhaps a bug? (I have to ask my client if cancellation fees are needed)
Re: How to transfer back money by PayPalExpress (not backend)?
The order/email/payment job controller currently sends that e-mail but it's not suitable for credit notes. You can remove the refund status by setting the "controller/jobs/order/email/payment/status" configuration to [4,5,6] only:claude27 wrote: ↑23 Jan 2025, 13:59 The customer is receiving again the original invoice in the email and in the attached pdf and not something like a credit note (in german: Gutschrift, e.g. with negative values). Have I perhaps overlooked something?
And the email subject is still the same. But I think I can change this easily in the template.
https://aimeos.org/docs/2024.x/config/c ... /#status_1
Afterwards, you need to copy the order/email/payment job controller and it's templates and rewrite them for a credit note.
We would love if you can create a PR with your changes so we can integrate it into the core and offer it in the next release
Professional support and custom implementation are available at Aimeos.com
If you like Aimeos, give us a star
If you like Aimeos, give us a star