Creating a coupon via API - php

Currently when attempting a coupon (POST) at resource "/coupon.json" we are getting the following return JSON:
Response Code:
{"status":400,"message":"The field 'id' cannot be written to. Please remove it from your request before trying again."}
The "ID" field is obviously no where in our code but we are still receiving this error.
In to this addition we thought it might be from the "applies_to" as that object resource contains an "ids" element but we disabled that and still received the same effect.
At this time it is our best guess that this is a bug on the server side that is registering incoming JSON for the coupon resource with an "ID" point on it.
Question: Is creating a coupon currently possible?

It is possible to create coupons. I got it working both from a php script and using the developer playground at https://developer.bigcommerce.com/console
$coupon = array('name' => 'FJKDJFKD', 'type' => 'percentage_discount', 'amount' => 50.0, 'code' => 'JFKDFE', 'enabled' => true, 'applies_to' => array('entity' => 'products', 'ids' => array(32)), 'shipping_methods' => array());
print_r($coupon);
Screenshots from the playground -

Related

How to invoke my application on google home simulator without dialog flow integration?

I want to invoke my application from google home simulator but without integration of dialogflow is that possible? i provided fulfillment url in Actions Console but it does not invoke my app and shows me an error.
You cannot use standard Google Assistant features in the Simulator. If
you want to try them, use Google Assistant on your phone or other
compatible devices.
below is my php code.
sendMessage(array(
'expectUserResponse' => true,
'expectedInputs' =>
array (
0 =>
array (
'inputPrompt' =>
array (
'richInitialPrompt' =>
array (
'items' =>
array (
0 =>
array (
'simpleResponse' =>
array (
'textToSpeech' => 'Hi!',
),
),
),
),
),
'possibleIntents' =>
array (
0 =>
array (
'intent' => 'actions.intent.TEXT',
),
),
),
),
'conversationToken' => '{"data":{}}',
'userStorage' => '{"data":{}}',
));
You can use actions on google without any integrations with Dialogflow using the actionsSDK, but without Dialogflow you dont have a service which analyzes your users input and breaksdown intents and entities. So if you want to remove Dialogflow from your setup you will have to use a different service which takes the input from your user and analyzes it.
Using the actions SDK, you can provide a webhook URL using the gactions CLI and here you will have to write code which sends the input to the NLP and returns an intent. Then you can use that info to do the logic that you need to create a response for the user.
I personally haven't tried mocking the requests and tried to invoke my action with messages, but if you want a normal assistant, but without Dialogflow. That is how you can do it.

ALL GCM parameters?

i´ve written a "pushserver" for my app via PHP.
The push notifications i´ve sent via PHP are all received on the device, so far.
But, i can just send/set the "message" and "title", see:
$fields = array(
'registration_ids' => $registrationIDs,
'data' => array(
'message' => $message,
'title' => 'My App',
'vibrate' => 1,
'sound' => 1,
'icon' => "http://example.com/image.jpg",
"style" => "inbox"
),
);
"icon" and "style" are not working (vibrate and sound not tested, yet).
Every link for the parameters i´ve found is broken or kind of "you need to do object.setSomething() in JAVA.
Is there a list anywhere where i can see ALL parameters, which i can send to GCM? No matter, what language i use?
Cheers,
Chris
couple of things need to keep in mind while all the data which you sending from server end
Is there a list anywhere where i can see ALL parameters,
exp :- you can send as many parameters as you want but offcourse there is limitation but not key specific just like you can use "textmessage" instead of "message" but make sure to retrieve the value from same key which you are assigning from server end
1) please make sure that you are getting all the data in gcmintentservice class try to print the log of all intent data.
please remember that this is just a string data it is not going to download the image for you. you have to download using volley library or any suitable library

Need Your Advise on Recurring Payments With Paypal API on PHP

I'm trying to tame the PayPal API with moderate success. I use PHP for sending the request and processing the response. So far I've managed to compose a valid array containing the request parameters and send it to the Paypal for validation. The request goes through validation and returns transaction token as expected. Here's my array:
$requestParams = array(
'RETURNURL' => 'http://www.myurl.com/#success',
'CANCELURL' => 'http://www.myurl.com/#cancel',
'PAYMENTREQUEST_0_AMT' => 30,
'PAYMENTREQUEST_0_SHIPPINGAMT' => '10',
'PAYMENTREQUEST_0_CURRENCYCODE' => 'USD',
'PAYMENTREQUEST_0_ITEMAMT' => '20',
'ALLOWNOTE' => 1,
'L_PAYMENTREQUEST_0_NAME1' => 'Black kitten',
'L_PAYMENTREQUEST_0_DESC1' => 'Nice and fluffy cute guy',
'L_PAYMENTREQUEST_0_QTY1' => '1',
'L_PAYMENTREQUEST_0_AMT1' => '10',
'L_PAYMENTREQUEST_0_NAME0' => 'Ginger kitten',
'L_PAYMENTREQUEST_0_DESC0' => 'Super cute ginger dude',
'L_PAYMENTREQUEST_0_QTY0' => '1',
'L_PAYMENTREQUEST_0_AMT0' => '10'
);
THE QUESTION
I want to send the same request but to form a recurring payment. Which means I want to charge the user's PayPal account every month. I was surfing throught PayPal API docs, but the way it's written seems super confusing for me and provides no answers whatsoever.
Maybe I should just insert another parameter to the $requestParams or maybe I should compose a completely different array or what? Please assist!
I actually just wrote an article about this a few days ago. It's a pretty quick run-through of the process so if you have more questions let me know, but I'd definitely recommend taking a look as it lays out everything you'll need to do, and it does it with my class library which makes this all very simple for you.
One of the way to implement recurring payment is using Express Checkout with creation of Billing Agreement and Reference Transactions. You can find details in official documentation here and here.

Recieving an array in VB.NET from a php (NuSOAP) web service

I have successfully managed to run many php (NuSOAP) web services from VB.NET, however I am unable return an array without the following error:
"There is an error in XML document (1, x)."
For the following three instances, I am able to get it working from php to php (NuSOAP), but from VB.NET to php(NuSOAP), it always returns the above error. These are the three examples.
xsd:Array
$server->wsdl->addComplexType(
'ArrayOfString',
'complexType',
'array',
'sequence',
'',
array(
'itemName' => array(
'name' => 'itemName',
'type' => 'xsd:string',
'minOccurs' => '0',
'maxOccurs' => 'unbounded'
)
)
);
$server->wsdl->addComplexType(
'Users',
'complexType',
'struct',
'all',
'',
array( 'Users' => array('name' => 'UsersIn',
'type' => 'xsd:Array'))
);
Is this a limitation, or is there something else I can do? Thanks
Edit:
OK, I've searched far and wide for this issue and seen so many that have tried to solve it but none succeed. It appears to be a.NET issue possibly due to php communication, so I would rule out NuSOAP because I hardcoded the same thing in pure php and it resulted in the same problem.
I have also looked at the xml files returned by SOAP and they all validated while the error locations were in pretty harmless locations. I think possibly the xml file it is looking at may not actually be the one returned by SOAP but something else or otherwise recently serialized, the reference is, 'System.Xml.dll'.
I also played around with some basic encoding on the database and SOAP server but that didn't change the result.

Example of sending POST and FILES data from iPhone to a remote PHP website

I'm programming an API of sorts on a PHP website I built with the goal that another programmer can send data (POST and FILES date) to my PHP website from their iPhone app so that I can process the data and return some of my own.
We've been struggling to find a way that he can send POST data (though we found a pretty hacky workaround) and FILES data from the iPhone app. The goal on my end would be to receive a POST array and a FILES array similar to (in PHP of course):
$_POST = array(
'key' => 'key-value-here',
'token' => 'token-value-here',
'id' => 'id-value-here'
'values' => array(
'name' => 'Name value here',
'description' => 'Description value here'
)
);
$_FILES = array(
'photo' => array(
'name' => 'photo-name.jpg',
'type' => 'image/jpeg',
'tmp_name' => '/tmp/path',
'error' => '0',
'size' => '12345'
)
);
Any help you could offer us on how we could send such data would be greatly appreciated. Also, the iPhone app programmer is trying to avoid using the ASIHTTPRequest library for now (for a number of reasons).
Just create a multi-part post. For how it should look like, see a multi-part message. I have never worked with the iPhone, so I couldn't tell you which library could do this, but if all else fails, it's just an open socket connection & some string manipulation...

Categories