bigcommerce single page checkout not working in checkout sdk - bigcommerce

hello every one i am new in big commerce.
Now i am updating single page checkout using checkout sdk. every thing work fine till now i am following git hub implementing instructions . But the the problem is after update customer shipping address need to select the shipping option for shipping. I am using this syntax for doing this
const saddress = {
address1: $('#shippingaddress').val(),
address2: "",
city: $('#shippingcity').val(),
company: "",
country: $('#shippingcountry').val(),
countryCode: "AU",
customFields: [],
email: $('#email').val(),
firstName: $('#shippingfname').val(),
lastName:$('#shippinglname').val(),
phone: $('#shippingphone').val(),
postalCode: $('#shippingzip').val(),
stateOrProvince: $('#shippingProvince').val(),
stateOrProvinceCode: $('#shippingProvince').val(),
};
const updateaddress = await
service.updateShippingAddress(saddress);
After complete this action the function return all shipping address details along with the ID column and shipping options available in this address. but the problem is that function return the options and also the shipping address details but no ID column found in that list. that's why i am sending the billing address ID for select shipping option this is my code
const newState = await service.selectShippingOption(billing_ID, Shippingoption_ID);
after that i am going to direct payment options my code is
const payment = await service.loadPaymentMethods();
let paymentmethod=payment.data.getPaymentMethods();
in this function i am getting all the payment options details then i go for payment my code is
wait service.initializePayment({ methodId: 'testgateway' });
const payment = {
methodId: 'testgateway',
paymentData: {
ccExpiry: { month: 10, year: 20 },
ccName: 'BigCommerce',
ccNumber: '4111111111111111',
ccType: 'visa',
ccCvv: 123,
},
};
After complete this function this function return a error
Error: "Your order is missing a shipping method. Please return to the
shopping cart and checkout again."

Related

Query Loopring NFTs using the GraphQL "Playground"

Hello and thanks in advance for any help.
I would like to write a simple query to find out Loopring NFT (non-fungible token) data using the Loopring subgraph, given a user account number. (Note the account number is the Loopring address, similar to an Ethereum address, a hexadecimal as string type)
The subgraph playground for Loopring is here: https://thegraph.com/explorer/subgraph?id=7QP7oCLbEAjejkp7wSLTD1zbRMSiDydAmALksBB5E6i1&view=Playground
Here is my code:
query accountNFTSlotsQuery(
$skip:Int
$first:Int
$orderBy: AccountNFTSlot_orderBy
$orderDirection:OrderDirection
$where:AccountNFTSlot_filter
) {
accountNFTSlots(
skip : 0
first: 100
orderBy: createdAt
orderDirection: asc
where: {
account: "0x08F06d44D6D3e35a3790392571194d86090C863539277"
}
) {
id
account {
id
}
balance
nft {
id
nftType
nftID
mintedAt
}
}
}
The playground is returning...
{
"data": {
"accountNFTSlots": []
}
}
Which I interpret as returning NULL, or "no data found". For the address above, one can verify NFTs exist using lexplorer:
https://lexplorer.io/account/39277
Variations:
I have tried several accounts which I know have NFTs.
I have tried replacing the "account" string with an "id" in the 'where' filter thus:
where: {
id: 39277
}
Model:
I used this github repo as a model for my queries: https://github.com/fudgebucket27/Lexplorer/blob/master/Shared/Services/LoopringGraphQLService.cs

Razorpay response not sending Razorpay order_id

I am working on React Native Razorpay payment gateway integration.
I am using react-native-razorpay.
Code is below:-
Send Params are:-
var options = {
description: "Credits towards consultation",
image: "https://i.imgur.com/3g7nmJC.png",
currency: "INR",
key: "a-----b----ccc-dd",
amount: Math.round(Number(order_total).toFixed(2) * 100),
name: "Product",
prefill: {
email: email ? email : "v#razorpay.com",
contact: mobile ? mobile : "1111111111",
name:
firstname && lastname
? `${firstname} ${lastname}`
: "Razorpay Software"
},
theme: { color: theme.colors.primaryColor },
payment_capture: 1
};
Checkout Method:-
RazorpayCheckout.open(options)
.then(data => {
// handle success
console.log("payment success", data);
if (data && data.razorpay_payment_id) {
orderData.payment = data.razorpay_payment_id;
this.props.payMyOrder(orderData);
}
})
.catch(error => {
// handle failure
this.toast.show(error.description);
});
I am getting only razorpay_payment_id in response but, razorpay_payment_id and razorpay_signature are missing. Also, in Razorpay backend Razorpay Order Id and Order Id are missing.
hey as we can see in the above code options object that you are passing to the checkout you are not passing the order_id, you should pass the order_id as well. Since you are not passing the order_id the same is not getting returned to you after the payment is done. refer to the below link on how to create an order at your server-side.
https://razorpay.com/docs/api/orders/
if you pass the order_id in the request param to the checkout you'll get the order_id and signature as well in the payment response.
Please check the documentation we need to pass the order_id, here.
As per the documentation, once you pass the order_id, then only after payment successful razorpay returns the
razorpay_order_id,razorpay_payment_id and razorpay_signature.
After that you can compare the signature to get acknowledgement of payment success.
Just a note if your id is wrong your razorpaySignature too will not appear
Issue mostly will be because of invalid order Id, the order id received from Backend should be the one backend got from Razorpay.
Something like below should be used at your backend to generate order id (format of order id will be order_<some id>). You can get language based backend implementation at this link
var instance = new Razorpay({ key_id: 'YOUR_KEY_ID', key_secret: 'YOUR_SECRET' })
instance.orders.create({
amount: 50000,
currency: "INR",
receipt: "receipt#1",
notes: {
key1: "value3",
key2: "value2"
}
})

Create Shopify product with Variant SKU using API

I am trying to create Products on Shopify using the API,
In the CSV upload there is a field Variant SKU which sets the (default) product SKU, I can't seem to find the correct way to create a product along with this value?
I tried (python3);
import requests
import json
from config import SHOPIFY_URL
payload = {
'product': {
'title': 'Hello Product',
'variants': {
'option1': 'Primary',
'sku': 'hello-product'
}
}
}
requests.post(
f'{SHOPIFY_URL}/products.json',
headers = {'content-type': 'application/json'},
data=json.dumps(payload)
)
The product get created but the SKU doesn't.
The TL;DR of my question;
What to I need to pass to fill the Product CSV Upload file's field Variant SKU?
Update
Thanks to David Lazar's comments, I realized that I need to use a list of variants.
payload = {
'product': {
'title': 'Hello Product',
'variants': [
{
'option1': 'Primary',
'sku': 'hello-product'
}
]
}
}
This however creates the product with one variant using the passed SKU.However what I am looking is to create the Porduct with its own SKU, no variations for the product, just a SKU for the product.

Setting the tax code on a Sales Order Item in SuiteScript 2.0

I have created a script to add a Finance Charge item to my sales orders when they are edited but can't get it to set the tax Code. Also the line is not committing (because of the tax code issue?)
I have tried Internal IDs and names but am stuck
Any help?
define(['N/currentRecord'],
function(currentRecord) {
function AddFinanceCharge() {
try {
var record = currentRecord.get();
record.selectNewLine({ //add a line to a sublist
sublistId: 'item' //specify which sublist
});
record.setCurrentSublistValue({ //set item field
sublistId: 'item',
fieldId: 'item',
value: 1003 //replace with item internal id
});
record.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'quantity',
value: 1 //replace with quantity
});
record.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'taxCode',
value: 'VAT:S-GB'
});
record.commitLine({ //writes the line entry into the loaded record
sublistId: 'item'
});
log.debug ({
title: 'Success',
details: 'Alert displayed successfully'
});
} catch (e) {
log.error ({
title: e.name,
details: e.message
});
}
}
return {
pageInit: AddFinanceCharge
};
});
If you only use Tax codes, not Tax Groups I believe you can create a search to find internal ids:
var taxitemSearchObj = search.create({
type: "salestaxitem",
columns: ["internalid", "country", "rate"],
filters: [['firstFilter', 'firstComparisonOperator', firstValue]], 'and', ['anotherFilter', 'anotherComparisonOperator', anotherValue]] // i.e. ['itemid', 'is' 'VAT:S-GB'],
});
You can find available search filters in the NS record browser-
here (2019.2 version)
'VAT:S-GB' might be itemid? Then:
var taxCodeInternalId = taxitemSearchObj.run().getRange(0,1)[0].id // If you know there is only 1 code matching the search query
record.setCurrentSublistValue({
sublistId: 'item',
fieldId: 'taxcode', // FYI I'm not sure if capitalization matters here but I downcased the capital C
value: taxCodeInternalId
});
**Disclaimer - Does NOT work with mixed tax code / tax groups. To get that you'll need to make the search dynamic ('taxgroup' or 'salestaxitem'). Unfortunately Netsuite will overwrite your taxcode internal ID if "ENABLE TAX LOOKUP ON SALES AND PURCHASES" is selected in your tax preferences (Setup > Accounting > Tax Setup - set per nexus). If this option is not selected you'll need to make sure to set a tax code on every line item.
you have to pass internal id of the tax code if you re using setValue, use SetText instead of setValue and check.

Stripe + Apple Pay: Can I charge any amount I want if I have a token?

I'm looking into this stripe / apple pay library for React Native: https://github.com/tipsi/tipsi-stripe
Below is an example:
const items = [{
label: 'Whisky',
amount: '50.00',
}, {
label: 'Tipsi, Inc'
amount: '50.00',
}]
const shippingMethods = [{
id: 'fedex',
label: 'FedEX',
detail: 'Test # 10',
amount: '10.00',
}]
const options = {
requiredBillingAddressFields: 'all',
requiredShippingAddressFields: 'all',
shippingMethods,
}
const token = await stripe.paymentRequestWithApplePay(items, options) // <-----------------
// Client specific code
// api.sendTokenToBackend(token)
// You should complete the operation by calling
stripe.completeApplePayRequest()
// Or cancel if an error occurred
// stripe.cancelApplePayRequest()
Let's say my user agrees to buy the Whisky and Tipsi items above and goes through Apple Pay and a token is received. Is that token only valid for that amount ($50 + $50 + 10)? In my app, I allow the user to remove things from their order before they actually get charged, which would mean I would use the token to charge them for an amount that was different from what they agreed to when they pressed ok in Apple Pay.
So if the token returned is for $110, can I end up charging only $60?