I have enabled taxes for default customer group. I user is not logged opencart displays products prices with taxes, when customer log to account products prices are displayed without prices. Where can be problem ?
I have only 1 zone/ country.
Opencart Tax works on current customer customer group. Like you are saying you enable tax for default customer group. So when a customer is not login means, customer is guest, Opencart set default customer group to that customer.
//code in your index.php where OC set customer groups for current customer
// Customer Group
if ($customer->isLogged()) {
$config->set('config_customer_group_id', $customer->getGroupId());
} elseif (isset($session->data['customer']) && isset($session->data['customer']['customer_group_id'])) {
// For API calls
$config->set('config_customer_group_id', $session->data['customer']['customer_group_id']);
} elseif (isset($session->data['guest']) && isset($session->data['guest']['customer_group_id'])) {
$config->set('config_customer_group_id', $session->data['guest']['customer_group_id']);
}
so when customer is not login then price is displaying with taxes and when login then price is showing without taxes - Reason must be that your login customer has customer group other than default one.
You can check customer group after edit customer from admin side.
Related
I'm trying to auto charge customers on stripe in NodeJS
I have an issue where some customers have a:
default_source
and some have
invoice_settings.default_payment_method
My current workflow (C# WPF):
Create customer + Add subscription to customer
Get URL for portal
Customer adds card details on stripe portal
This works fine and payment are running well.
I also charge for SMS fees using a nodejs api:
async function chargeSMS(stripeCusID,chargeValue,chemistName,chemistID,countSMS){
//console.log(stripeCusID);
//console.log(chargeValue);
let customerObject;
let payMethodID;
customerObject = await stripe.customers.retrieve(
);
console.log("PaymentID received:" + customerObject.invoice_settings.default_payment_method);
payMethodID = customerObject.invoice_settings.default_payment_method;
await stripe.paymentIntents.create({
amount: chargeValue,
currency: 'aud',
customer: stripeCusID,
description: 'SMS Charges: ' + countSMS + " sent",
payment_method: payMethodID,
confirm: true
},
function(err, response) {
if (err) {
console.log("Charge", err.message,stripeCusID,chargeValue,chemistName);
return;
}
console.log("Successful SMS Charge:", response.id,chemistName);
chemCharged(chemistID);
})
}
This has also been working fine as a Cron on 1st of each month.
My issue is that recently one of my customer's cards expired.
They used my WPF to open the portal and add a new card
This worked.
HOWEVER this new card on the portal is only listed as
customer.default_source
Their
invoice_settings.default_payment_method
Is now null!
So my code above fails.
I've checked and:
All new customers using portal have their cards saved as invoice_settings.default_payment_method
any time a customer adds a new card it is only added as defult_source
I ahve no idea why this is the situation but I'm using the stripe customer portal so i would have thought they would add in the same way!
Any ideas how I can fix this or figure out what I've done wrong?
On the stripe web portal (my business) I can see that this customer DOES have a default card, and it looks the same as any other customer, but the api side has it registered under the different section!
You can add the Card as the Customer's invoice_settings.default_payment_method yourself by calling the Update Customer API.
FYI in a subscription the precedence chain is:
Subscription's default_payment_method
Subscription's default_source
Customer's invoice_settings.default_payment_method
Customer's default_source
This is what my customer sees when I redirect to the portal. But I want them to be able to select a plan and add a payment method themselves.
This is how I'm getting the URL:
const session = await stripe.billingPortal.sessions.create({
customer: req.body.stripeCustomerId,
return_url: 'http://localhost:3000/app',
});
I want the user to be able to select a plan, which I have as a Product:
From what I know, the BillingPortal does not support subscribing to new Prices/Plans. It only supports switching Prices/Plans (e.g. downgrading or upgrading) or updating quantities purchased: https://stripe.com/docs/billing/subscriptions/customer-portal
You would have to use Stripe Checkout to start your user on a Subscription, and then leverage BillingPortal to allow them to switch Prices.
I am encoutering a problem with stripe. let me explain my working
scenario.my requirement is do not charge user for 14 days with card up front
1)user enter card details
2)sca popup appear
3)regardless of user complete the authentication or not a subscription is created in stripe because i set trial_end_date=>now()+14 days
4)user payment fails in some reason and attempt again, another subscription created
i am worried about the duplicate subscription as the stripe will attempt to pay after the 14 days for both of these subscription as it send a Stripe-hosted link for cardholders for both of these subscription
let me give a snapshot of what i have so far
$data['customer']='customerId';
$data['items']=[];
$data['items'][0]['plan']='stripe_plan_id'
$data['default_payment_method']='pm_xxxx'
$data['trial_end']= strtotime('+14 days');
$data['prorate']=true;
$data['tax_percent']=env('VAT_PERCENTAGE');
$data['expand']= ['latest_invoice.payment_intent', 'pending_setup_intent'];
try {
$subscription=\Stripe\Subscription::create($data);
}
catch(Exception $e) {
return response()->json(['success' => false,'message'=>$e->getMessage()]);
}
what i am missing? how to prevent the duplicate subscription scenario.please expain with the correct example which is i am missing.thanks in advance
I think the problem is in your payment flow, there is not a stripe api that explicitly detects duplicate subscription. You are after all allowed to assign more then 1 subscription per customer id. You can create idempotent keys, but that isn't for the same thing you're talking about, idempotent keys are for accidently hitting the submit button twice within the same timeframe.
The solution would be to attach a payment method to your stripe customer id before your subscription trial is over. For example if you are using stripe elements you would call
Node/JS Example below :
const result = await stripe.createPaymentMethod({
type: 'card',
card: card
})
then pass that result to your backend
const result = await stripe.paymentMethods.attach(paymentMethodId, {customerId})
You do not need to create a new subscription, as one has already been created for that user. Credit cards are assigned to customer Ids, and not to subscriptions. Stripe will do the rest.
You do also need to update the customer with the default payment method as follows :
const customer_update = await stripe.customers.update(stripeCustomerId,{invoice_settings: {default_payment_method:paymentMethodId}});
Now when you visit your dashboard you will see a default card assigned to your customer. Once the subscriptions falls out of the trail period, the default card will be charged.
So in this case there wont be a duplicate subscription created, as you are not calling stripe.subscriptions.create again.
I would also like to retrieve the name of the person who paid. How can I get the name value from the stripe session? I have tried this:
const sessions = await stripe.checkout.sessions.list({
limit: 1,
});
console.log(sessions.data[0].customer)
const customer = await stripe.customers.retrieve(sessions.data[0].customer);
console.log(customer)
which gets me the email, but the name is null.
UPDATE: Customers created through Checkout have a null name because it is not collected/set. The "name on card" field on the Checkout page is for the cardholder name for the payment method, not the name of the customer (see https://stripe.com/docs/api/payment_methods/object#payment_method_object-billing_details-name). If you want a Customer created through Checkout to not have a null name, you'll have to update the Customer after the session is completed.
Stripe has a dashboard setting (https://dashboard.stripe.com/settings/emails) you can enable that automatically sends receipts to customers for successful payments completed in live mode. Payments completed in test mode will not automatically send an email, but you can trigger one manually through the dashboard. You can read more about sending receipts here: https://stripe.com/docs/receipts#automatically-send-receipts-when-payments-are-successful.
If you want to grab the customer’s email and send a receipt yourself it’ll be a bit more complicated.
Wait for the Checkout Session to finish by listening for checkout_session.completed through a webhook endpoint (https://stripe.com/docs/payments/checkout/fulfill-orders#handle-the-checkoutsessioncompleted-event).
Grab the customer ID from the Checkout Session object that comes in with the checkout_session.completed event.
Using the customer ID from the previous step, retrieve the Customer object (https://stripe.com/docs/api/customers/retrieve) and get the customer’s email.
Team,
I'm using the demo version of docusign API in my web application (test),
I have updated the connect functionality to connect to the salesforce in the demo account that i have. I need to understand how can I update the envelope status to sales force for the opportunity Im writing the contract for.
Steps
1 The user logs into our website
2 Clicks the DocuSign link (i call the demo API to show the docusign website in an IFrame)
3 The user is an Opportunity in salesforce
3 Depending upon the User response I show a final message page.
need to do.
Apart form the mails i receive, I want to update the docusign section for that user(oppurtinuity) in sales force. Our salesforce database is connected to the docusign.
Please do let me know if you need any other details. Appreciate your help.
Just add the following code:
envelopeInfo.CustomFields = new CustomField[] {
new CustomField {
Name = "##SFAccount",
Value = account.Id,
Show="",
Required=""
},
new CustomField {
Name = "##SFContract",
Value = contact.Id,
Show="",
Required=""
},
new CustomField {
Name = "##SFOpportunity",
Value = opportunity.Id,
Show="",Required=""
}
};