I'm making a subscription with Paypal, however the custom value I'm trying to create just isn't being received from the IPN from PayPal.
Therefore, I must be doing something wrong. To my knowledge, I'm passing the value correctly though?
This is my code, I'm trying to pass custom with my own value.
paypal.Buttons({
style: {
shape: 'rect',
color: 'gold',
layout: 'vertical',
label: 'subscribe'
},
createSubscription: function(data, actions) {
return actions.subscription.create({
'plan_id': 'P-000',
'custom': 'custom value' // the custom parameter attempt
});
},
onApprove: function(data, actions) {
alert(data.subscriptionID);
}
}).render('#paypal-button-container');
The parameter is documented as custom_id here: https://developer.paypal.com/docs/api/subscriptions/v1/#subscriptions-create-request-body
Unknown parameter names like custom will be ignored
Related
I'm trying to build my first paypal shopping payment system. Paypal helpfully provide some base code to aid with this:
<div id="paypal-button-container"></div>
<script src="https://www.paypal.com/sdk/js?client-id=[MY-CLIENT-ID]¤cy=GBP" data-sdk-integration-source="button-factory"></script>
<script>
paypal.Buttons({
style: {
shape: 'rect',
color: 'white',
layout: 'vertical',
label: 'paypal',
},
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '1'
}
}]
});
},
onApprove: function(data, actions) {
return actions.order.capture().then(function(details) {
alert('Transaction completed by ' + details.payer.name.given_name + '!');
});
}
}).render('#paypal-button-container');
</script>
I can't seem to figure out how to set the 'value' label inside the function inside of:
createOrder: function(data, actions) {
return actions.order.create({
purchase_units: [{
amount: {
value: '1'
}
}]
});
My website is in bootstrap 4.5 with jQuery. On the site's index.html page I have 2 buttons that can be clicked to purchase two different services. Depending on which one the user selects, I use javascript to set the value in localStorage as follows: localStorage.setItem('serviceCost', $('#standard-cost').text()); This grabs a value from a span tag with ID 'standard-cost'. This is then used to set the text on the purchase.html page confirming for the user their selected item. I want to get the value from localStorage.getItem(serviceCost) and use it to set the cost for the 'value' key in the above function but everything I attempt is unsuccessful. The paypal script is embedded in a html page and the jQuery is in a separate file. The Paypal site doesn't offer any insight into this and I'm assuming this is a fairly common process, so how do you get a value from localStorage and pass it to the value variable in Paypal's generated code?
amount: {
value: localStorage.getItem('serviceCost')
}
Yep
I am using apex charts (https://apexcharts.com/) to show some data dynamically and some of this data might be currencies, some might be percentages and so on.
I have a component which has the data type in the data function like so:
data: function(){
return{
chartOptions: {
colors: ['#FEB910', '#00ABE7', '#949698'],
height: 500,
dataType: 'percentage' // dynamic - could be currency, percentage etc....
chart:{
toolbar:{
show:true
}
},
yaxis: {
labels: {
formatter: function (value) {
console.log(this.dataType) // this is undefined
}
},
},
},
}
},
Apex charts has a formatting function as you can see, and it works fine but I need a way to check if the dataType variable is percentage or currency so it can format it in a different way. I tried access the 'this' property but it is undefined.
Is there any way I can pass this function the 'this' property? or call it some how?
I managed to set the function on mount, which could possibly be substituted for a computed property.
this.chartOptions.yaxis.labels.formatter = function(value){
return value + "$";
}
After that is set, the formatter function runs and also has access to the 'this' property
I have made custom workflow activity, registered it with Plugin Registration Tool and now i want to execute it using Action. Action wont have input/output parameters. Unique name is ad_opportunity. It will be executed from Custom Entity ad_productsamplerequest
I will call this action from JavaScript using Process.js.
I am not familiar with Process.js, so I have a problem to make Action call.
Here is the call I made, but it doesn't work. Am I missing something here:
Process.callAction("ad_opportunity",
[{
key: "Target",
type: Process.Type.EntityReference,
value: { id: Xrm.Page.data.entity.getId(), entityType: "ad_productsamplerequest" }
}],
function (params) {
//Success
},
function (e) {
// Error
alert(e);
}
);
Value mentioned in your code should be declared as EntityReference. Please refer below code for same
Process.callAction("mag_Retrieve",
[{
key: "Target",
type: Process.Type.EntityReference,
value: new Process.EntityReference("account", Xrm.Page.data.entity.getId())
},
{
key: "ColumnSet",
type: Process.Type.String,
value: "name, statuscode"
}],
function (params) {
// Success
},
function (e, t) {
// Error
});
Rest looks good
I'm using Select2 (http://ivaynberg.github.io/select2/) to have an input field of a form (let's say its id is topics) to be in tagging mode, with the list of existing tags (allowing the user to choose some of these tags, or to create new ones) being provided by an array of remote data.
The array (list.json) is correctly got from my server. It has id and text fields, since Select2 seems to need these fields. It thus looks like this:
[ { id: 'tag1', text: 'tag1' }, { id: 'tag2', text: 'tag2' }, { id: 'tag3', text: 'tag3' } ]
The script in the HTML file looks like this:
$("#topics").select2({
ajax: {
url: "/mypath/list.json",
dataType: 'json',
results: function (data, page) {
return {results: data};
},
}
});
But the input field is showing "searching", which means it's not able to use the array for tagging support.
In the script with Select2, I know I have to define formatSelection and formatInput, but I'm not getting how they should work in my case, although I have read the Select2 documentation... Thank you for your help!
You need to add the function like explained here. In your example:
function format(state) {
return state.text;
}
I'm wondering how to have jqGrid custom formatter to call a seperate function, "test1"? I get an undefined error on the "test1" function.
Script #1...
//colModel json objects...
{ name: 'Vin', index: 'Vin' },
{ name: 'Links', index: 'Links', formatter: jqgridCellFormatterLink }
//jqGrid formatter function...
function jqgridCellFormatterLink(cellValue, options, rowObject) {
return "<span onclick='test1(\"" + rowObject[0] + "\");'>Test</span>";
}
//non-jqGrid function
function test1(parmVin) {
alert(parmVin);
}
Thanks...
//Script #2...
//colModel json objects...
{ name: 'Vin', index: 'Vin' },
{ name: 'Links', index: 'Links', formatter: function(cellValue,options,rowObject) { return "<span>Test</span>";} }
beforeSelectedRow: function(rowid, e) {
if (this.p.colModel[$.jgrid.getCellIndex($(e.target).closest("td")[0])].name === 'Links')
{
alert($('#blah').getCell(rowid, 0)); //Can be 0 or 'Vin'...
}
}
I recommend you to use approach described in the answer and in this one. You don't need to bind onclick to some global method. Instead of that it's more effective to use beforeSelectRow or onCellSelect callback which will be called inside of one existing click event handle.
By the way, the formatter which you posted could don't work because the format of rowObject depend on many things: how you fill the grid, which datatype you use ("local", "json" or "xml" can produce different format of rowObject), whether you use repeatitems: true or some other settings of jsonReader, whether you use loadonce or not and so on.