Magento Add fee on grand-total depending about payment gateway user selcted - magento

I need to add extra fee on grand-total and fee depend upon payment gateway user selected means if user select payment method 1 fee will be $3 and so on....I'm able to add fee on grand total with help of "sales_quote_collect_totals_after" observer.
Now I need to get current payment gateway so I will charge user according that.
Thanks in advance

Related

Pay now once and, optionally (!), create a subscription too -- how to do this in Stripe?

On a page there's a textbox where a customer or payer enters an amount to donate to me via Stripe, as one time payment. And there's also a checkbox "subscribe for $5/mo" which, if checked, would charge him that amount afterwards.
The thing is:
it's a one time payment in any case and charged immediatelly; a custom amount -- whaterver a customer enters. And, optionally, a customer would be charged $5/mo within a subscription, automatically, starting in a month - if, and only if, he checks a checkbox.
I know how to create a session for charging a customer one time, and here's code, partially:
stripeParams := &stripe.CheckoutSessionParams{
PaymentMethodTypes: stripe.StringSlice([]string{
"card",
}),
LineItems: []*stripe.CheckoutSessionLineItemParams{
&stripe.CheckoutSessionLineItemParams{
PriceData: &stripe.CheckoutSessionLineItemPriceDataParams{
Currency: stripe.String(string(stripe.CurrencyUSD)),
ProductData: &stripe.CheckoutSessionLineItemPriceDataProductDataParams{
Name: stripe.String("test123"),
},
UnitAmount: stripe.Int64(amount * 100),
},
Quantity: stripe.Int64(1),
},
},
Mode: stripe.String(string(stripe.CheckoutSessionModePayment)),
//........
How would I implement the "plus a subscription of $5/mo on top" thing?
If you want to create a Subscription through a Checkout Session you should follow this guide: https://stripe.com/docs/billing/subscriptions/checkout
To summarize, if you want to add a $5 subscription on top of the one-time payment amount entered by your customer you would do the following:
Create a Product and an associated $5 recurring Price in the Dashboard or the API
Change the Checkout Session from mode: payment to mode: subscription (see apiref)
Add the Price ID you created in Step 1 and add it as an additional Line Item for the Checkout Session (see apiref)
Set either subscription_data.trial_end (apiref) or subscription_data.trial_period_days (apiref) so that the recurring price is not charged until after the trial is over. The one-time price will still be charged upfront, even if the recurring price is on a trial.
If you don't want to use trials, you could also look into adding a one-time $5 discount to the Session.

Delayed payment after placing order

After placing order customer gets email with information about this order what includes payment method. If customer doesn't pay the order on the page where did he place it, the order still exists in customers acoount as pending or processing (due to payment method).
Where or what should I look to make link for payment for unpaid orders?
Or should they just "reorder" it?

Shipping Amount for different payment method in magento

how to apply different shipping amount for each payment method in magento? Now i am currently using two payment methods.
1) credit cart
2) Cash on delivery.
When customer selecting credit cart payment method shipping price is free.
and when customer selecting Cash on delivery payment method shipping price is 100.
FYI : my default shipping amount is 100.
Can anyone explain me briefly?
Thank
Prakash.
The problem is that the payment method is chosen based on the shipping method, so you can't change the shipping after choosing a payment method.
One possibility is to offer to different shipping method which restrict the payment methods after selecting.
I've created a magento module which does this, feel free to take a look on the sourcecode how it restricts payment methods based on shipping rates. This is the way I'd go.
https://github.com/thebod/Thebod_Shippingrates
You can create a Promotion rule with the Shopping Cart Price Rule for specific Payment Methods.

Remove Tax at Checkout for B2B customers in Magento

I need to dynamicaly remove tax during checkout for business to business customers in Magento. I have a module which asks for a VAT ID during checkout and checks it against the European Online VAT-ID Validation Service. If the VAT ID is valid, the tax should be removed during checkout.
The module already assigns new customers with valid VAT ID to the according business to business group in Magento. Customers who order for the first time and create their account during that first checkout, get charged VAT (even with valid VAT-ID).
I basically need to know, how this can be done, which methods involved, etc.
I've got a similar setup going on at the moment, what I have done is if the VAT# at checkout is stored in mage_checkout_model_session. The call
Mage::getSingleton('checkout/session')->getQuote()->getCustomerTaxvat()
In my instance is returning the VAT number for me to check elsewhere. Your VAT# validator is certainly setting something similar to this. At this point you can either create a new module to modify the tax, or override the controller with
$x = Mage::getSingleton('where_your_extension/stores_the_value)->getIsVatValid();
if ($x) $this->setTaxValue( 0 );
else //magento sets it automatically
and it will set the tax rate to zero for the remainder of the session. It will work with guests and registered customers.

how can i decrease the product price on cart page?

If the user has an existing account balance, I'd like to give him the option to specify how much of his previous balance to apply to the item and sync this info with the cart and order. I have already implemented the user's account balance, both on the front and back end.
Would a coupon-like system work best, or should I try something else?
Thanks in advance.
I would let the customer decrease its cart total with the balance would be more simple / logic for the customer also (?)
What E-commerce solution do you use? Magento(?) If so there are coupon extensions that can handle this.
You could also build a simple balance system where users would see there balance in there account ( if such feature is implemented) or just mail them a message with a unique code that you save in DB + the value of balance then use this code as a coupon on checkout.
We have created quite a few e-commerce solutions up to date. Usually, when user balance is involved, then what you do is create two transactions referred to one invoice. In the first transaction specify the amount taken from balance, where as leave the other transaction for whatever checkout method you use. Upon callback from the checkout, see if the balance paid matches the invoice to mark it as paid respectfully.
Alternatively, you can use discount - decrease user balance and add "discount" to the order. It all depends on your accounting needs and preferences.
On Amazon they allow you to apply any unused balance to the existing order. Its when you checkout that they say you have $150 credit on your account, would you like to apply this to your order, it defaults to yes in a tick box.
Its quite neat and simple, it doesn't allow you to apply a part amount from what I've seen.
Then when you go to payment you pay $total - balance.
So if you have $200 total, the payment via credit card would be for the $50.

Resources