Short Version:
I want to only accept Paypal as the form of payment for anyone outside of the lower 48 in the US.
I don't see how this isn't a feature already installed in bigcommerce under payment options and simply hiding those payment gateways based on the selection from the dropdown country menu.
Unfortunately I don't know bigcommerce well enough but I've managed to code this in on other carts like x-cart without much issue.. Has anyone experienced this or have a fix for me?
Currently we have disabled payments via our merchant to anyone outside of the US and placed a banner on our site when signing up for your account for payment, but then people will sit there and try to enter their CC information 12 thousand times flooding my mail box with capture alerts -_-
Thanks in advance
Currnetly running Cornerstone 1.5 Theme
One possible solution could be to use JavaScript to read either the shipping or billing country and then display the relevant payment methods.
Here's a conceptual example assuming you know how to select the specific elements (use your browser's developer tools to determine the proper selectors for your target elements)..
/**
* This example binds a change event to the shipping country input dropdown,
* so whenever a country is selected or changed, this code will show the relevant
* payment methods.
* NOTE: The change method here might not work if the payment methods section
* is inaccessible at the time of country selection, at which point you should
* modify the code to read the country at the time of DOM load for the payment methods.
*/
//** Whenever the shipping country is selected or changed **//
$("#shipping_country_dropdown").change(function() {
// Hide/Clear all visible payment options:
$(".payment_methods :input").each(function() {
$(this).hide();
});
togglePaymentMethodsByCountry($(this).find('option:selected').text());
});
/**
* Displays specific payment methods depending on the customer's selected billing or shipping country.
* You set the list of countries and their allowed payment methods here.
* #param country String - The customer selected country.
* #return Void
*/
function togglePaymentMethodsByCountry(country) {
//** Define your country/payment options here, countries in caps **//
switch(country.toUpperCase()) {
case "UNITED STATES OF AMERICA":
$('#payment_method_1').show();
$('#payment_method_2').show();
$('#payment_method_3').show();
break;
case "CANADA":
$('#payment_method_1').show();
$('#payment_method_2').show();
break;
default:
// For all other countries not listed above:
$('#payment_method_3').show();
break;
}
}
Related
I created a POC with a customer/credit card in Stripe and I logged into my dashboard within Stripe and was able to see this customer has a default source (the test credit card I added) associated correctly. It shows this card is the default source.
When I run this .Net code:
var customerService = new CustomerService();
var stripeCustomer = await customerService.GetAsync(customerId);
To get that customer, it returns everything correctly except his source. All of the fields I had hoped I can find it from are empty! I want to know his default payment source so I can show it on the front end with a little icon to indicate it's default.
DefaultSource, DefaultSourceId, and Sources properties are all blank/null.
Is there a way to have Stripe return it, or do I need to do something else? I tried the 'expand' property for the GetAsync method but that threw an error saying the above properties are not expandable (i.e. I can't ask Stripe to expand/return Source).
Any ideas what I can do?
FYI I also tried this:
var paymentMethodService = new PaymentMethodService();
var cards = await paymentMethodService.ListAsync(new PaymentMethodListOptions { Customer = customerId, Type = "card"});
and there doesn't seem to be a property anywhere that says the card is default (although it does correctly return all cards). I believe Stripe documentation states the Customer is the holder of the default source, not the card object. What gives?
Thanks in advance!
It looks like you're using Payment Methods, since your payment method list call has the results you expect, which means the customer likely doesn't have any sources. You can try that again with the properly pluralized expand[]=sources if you do know your Customer has Sources attached.
For Payment Methods, there is no general default for the Customer. For one-time Payment Intents, you must always specify the payment_method from among those attached to the Customer for future payments.
For paying invoices (related to recurring subscriptions, eg), you can set the invoice_settings.default_payment_method for Customer. This only applies to invoices.
We allow sales to attach Prospects to an Opportunity and Quote, and once credit has qualified the prospect they promote the prospect to a customer. What we need to do is hide the "Sales Order" button on the quote, or disallow advancing the quote to a sales order.
I was hesitant to ask this- seems like it should be intuitive to figure out. I looked at the standard NetSuite button id's in NetSuite help but there wasn't one for "Sales Order". I've looked at validation logic but this isn't validation as the sales order button is shown when record is not in edit mode. If possible I'd like the solution to be form independent.
I'd be happy to hide the button or letting the user click the button and preventing them from creating the sales order. It might be more user friendly doing the latter because if the button is hidden sales will be calling asking why the button is not there.
For clarity here is an image:
I am assuming that when you are talking about "the Sales Order button", you mean this one:
I'm not sure if this is the best user experience, or if you have NetSuite development resources available to you, but here is one option:
Create a new User Event script that is deployed to the Sales Order (and any other Transaction record you may want this prevention on). Using the BeforeLoad event, you can check if the Entity on the Transaction is in the Prospect stage. If they are, then the script will throw an error, preventing the creation of the Transaction. Code to accomplish this:
function onBeforeLoad(type) {
var entityId = nlapiGetFieldValue('entity');
if ((type != 'create') || !entityId) { return; }
if(nlapiLookupField('customer', nlapiGetFieldValue('entity'), 'stage') === 'PROSPECT') {
throw nlapiCreateError('INVALID_REQUEST', 'You cannot create a Sales Order from a Quote placed for a Prospect');
}
}
I tested this code in a TSTDRV account, and it works as expected. You might alternatively be able to build a workflow that does the same thing without requiring you to write code, but I did not attempt this.
By using a User Event script, this code will be form independent as well as entry point independent, meaning that this code will execute if the Sales Order is being created through the UI, through some other script, through a web services integration (depending on your web services configuration), or through a CSV import (depending on your CSV import configuration).
To hide the option:
If you're referring to the dropdown list, you can create a script for context view/edit to do the following:
setFieldAndLabelVisibility("nl13", false);
Otherwise, replace nl13 with the value of the table or td element shown when you inspect element on the desired Sales Order link/icon.
--The ID in the example above is the table, button or label ID shown when you inspect element
In 2014.2 Netsuite changed it's structure of addresses making them subrecords. They have a lot of help around scripting addresses on the Customer level or Form level, however I need to on the transaction (quote, sales order, invoice) level.
Help for transaction level appears to be just this page: https://netsuite.custhelp.com/app/answers/detail/a_id/39551/kw/address
This however is creating a custom address which shows that custom billing and shipping addresses have their own internal id.
What is the internal ID that I can use on the nlapiViewSubrecord(fldName) call to get at the values of say country, state, zip, etc on the billing and/or shipping addresses? I have tried 'billaddress' and 'shipaddress' respectively with no luck.
Try billingaddress and shippingaddress. I've recently made a similar update to some of our Sales Order code, and this is what worked for me.
// {String} The type of address to create, will be one of ship or bill
var addressType = (type === 'ship' ? 'shippingaddress' : 'billingaddress');
// {nlobjSubrecord} Address subrecord object
var subrecord = order.createSubrecord(addressType);
(This is in a RESTlet; the type value here is something that gets sent to us)
I am open to doing this via Forms, Workflows, or Suitescript. None have worked for me so far.
On a transaction, a user can change the bill to or ship to address for a customer. We are having issues due to the users using the Override feature and not the normal "Address Line 1, City, State, Zip" lines. Therefore, we want to disable the override functionality.
I cannot find this on any forms. I have tried workflows - I have disabled it on Before Record Load, Before User Edit, and Before field edit. I could not hide nor disable the Override button in any of these cases. I also tried hiding/disabling the Address free form text box they type in after they hit Override. I did this in all of the above stages as well as After Field Edit for when the Override button is pushed. Lastly, I attempted to just make the address fields mandatory. To do this, I tried setting Address Line 1, City, State, Zip all mandatory and again I tried before record load, before user edit, and before field edit. None actually worked. The workflow in any case would say it fired on Before Record load but when I went to add or edit an address, it still worked.
Part of my confusion comes on what exactly an address is. While the user is doing this on the transaction level (Quote, Sales Order, or Invoice), technically the update stores on the Customer Level. I tried applying the same above workflows on the Customer level with no success.
I am about to try scripting against this, but don't feel very optimistic based on all of the above testing with Workflows.
Has anyone else tried to do any manipulation against the Address on the transaction level? How did you do that? Again, I am open to forms, workflows, or Scripts. If you did it outside of these, please explain.
EDIT:
I still need help with this. This problem is persisting. Has anyone found a way to disable the "Override" feature on a transaction but still allow the drop down?
This seems to work to disable the drop-down select list for the Address on a transaction. I only tested it on a sales order but the theory should apply to other transactions as well.
var DcDisableAddress = {
beforeLoad : function(type, form) {
if (type == 'edit') {
var shipSelect = form.getField('shipaddresslist');
if (shipSelect) {
shipSelect.setDisplayType('disabled');
}
}
}
}
Use below as custom code in your address form.
/**
*#NApiVersion 2.0
*#NScriptName
*#NScriptType ClientScript
*/
define(['N/currentRecord'],function(currentRecord) {
function pageInit(context) {
var field = context.currentRecord.getField({
fieldId: 'override'
});
field.isDisabled = true;
}
return {
pageInit: pageInit
};
});
I'm working with creating salesorder in netsuite using suitescript but I can't find any document about "payment method", so how can I get a payment method such as VISA card and assign to the order? (I think it's required a payment method id but I didn't find payment method in supported suitescript records).
[update]
Here is my code:
var order = nlapiCreateRecord("salesorder");
// set some field value
// order.setFieldValue(....)
Now I want get payment method and shipping method id to set to order:
order.setFieldValue("shipmethod", shippingmethodId);
order.setFieldValue("paymentmethod", paymentmethodId);
I already have payment method name "Test Payment Method" and shipping method "Test Shipping Method". How can I get their id using their name?
For Payment Methods:
To get a list of the payment methods and their respective IDs available in your NetSuite account, you should navigate to Setup > Accounting > Accounting Lists. You will see a Type filter on the bottom of the page. Select Payment Method in there and you'll be able to see the different payment methods available for you.
For Shipping Methods:
Navigate to Lists > Accounting > Shipping Items.
Edit:
Actually you don't need to. Use nlobjRecord.setFieldText instead of setFieldValue i.e. order.setFieldText('VISA')
You can use hard-coded values instead of getting the values dynamically.