Expected an order id to be passed
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Implementing PayPal smart buttons on the site. On localhost (with sanbox accounts), everything is well paid. Then I created a live app, transferred it to production, and when I clicked on the button, I get an error Error: Expected an order id to be passed
Paypal account for an individual. It turns out that I cannot use the smart buttons of an individual's account?
- Labels:
-
Payments REST APIs
- Mark as New
- Bookmark
- Subscribe
- Mute
- Subscribe to RSS Feed
- Permalink
- Report Inappropriate Content
Try this: Obviously remove the jquery stuff in there for me
// Set up the transaction
createOrder: function(data, actions) {
$('#paypalmsg').hide();
$('#transmsg').show();
$('#transmsg').html('<b>'+'WAITING ON AUTHORIZATION...'+'</b>');
$('#chkoutmsg').hide()
return actions.order.create({
purchase_units: [{
description: 'GnG Order', ****MUST BE HERE***
amount: {
value: cartTotal ****ALSO MUST HAVE A VALUE***
}
}],
application_context: {
shipping_preference: 'NO_SHIPPING' ****ALTER FOR YOUR NEEDS***
}
});
},
// Finalize the transaction
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
/*return actions.order.get().then(function(orderDetails) { */
// Show a success message to the buyer
$('#transmsg').html('<b>' + 'AUTHORIZED...' + '</b>');
$('#transmsg').append('<br>'+'Transaction completed by: ' + details.payer.name.given_name +' '+ details.payer.name.surname + '<br>' + "Order Id: " + details.id + '<br>' + 'Status: PAID & APPROVED' + '<br>'+ 'Thank You For Your Order'+ '<br>');
if (details.status === "COMPLETED") {
window.setTimeout(function() {}, 500)
$('#transmsg').append('<b>' + 'Sending Order...Please Wait' + '</b>'+'<br>');
/* var getId = '#'+ $('span:contains("Market")').attr('id');
var getmrktDiv = '#'+ $(getId).offsetParent().attr('id');
var mrktchkId = '#'+ $(getmrktDiv).closest(getmrktDiv).find(".chkbox").attr('id');
var mrktpriceId = '#'+ $(getmrktDiv).closest(getmrktDiv).find(".price").attr('id');
var chkboxId = "#chk6";
var hidpriceId = "#pricef";
var marketLocation = $(mrktchkId);
if (marketLocation.length > 0 ) {
var checked = $(mrktchkId).prop('checked');
if (!checked) {
var storedVal = $(mrktpriceId).val();
if ($(mrktpriceId+':not([data-val])')) {
$(mrktpriceId).attr("data-val", storedVal);
}
$(mrktpriceId).val("");
}
} */
$('#transid').val(details.id);
$('#orderstat').val('APPROVED');
$('#orderform').submit();
}
});

Haven't Found your Answer?
It happens. Hit the "Login to Ask the community" button to create a question for the PayPal community.
- How to validate data existence on PayPal side in REST APIs
- Selected Shipping Method amount not updating to cart for card payment in SDKs
- CHECKOUT.ORDER.APPROVED webhook event not triggered if payment_source is passed in in REST APIs
- Why does PayPal redirect to different pages (login vs credit card form) depending on browser mode? in Braintree Server-side Integration (PHP, Java, .NET, Ruby, Python, NodeJS SDKs)
- Suspect orders yet payment accepted without AVS in PayPal Payments Standard