Sets the connection mode.


#include <bps/paymentservice.h>
BPS_API int paymentservice_set_connection_mode(bool local)


When the value is true the connection mode is set to local, otherwise the connection mode is set to network.




The paymentservice_set_connection_mode() function sets the connection mode that is used in the application. If the connection mode is set to local, the application does not contact the Payment Service server for any transactions. For purchases, a simulated purchase screen is displayed, allowing the user to choose the result of the purchase. For retrieving purchase history, only simulated successful purchases are returned. This mode is useful for testing how your application handles the possible results without requiring network connections or currency.

Note: Local connection mode should not be used in production code.

If the connection mode is set to network, purchases and retrievals of existing purchases proceed normally, contacting the Payment Service server as necessary. This is the default connection mode, and applications in production should not modify it.


BPS_SUCCESS upon success, BPS_FAILURE with the errno value set otherwise.