关于微信和支付宝提现的问题

1.微信提现

先说说微信提现的问题,因为微信的要求,提现到微信钱包需要第三方登录到微信获取用户unionId,登录这块我用的是友盟(偷个懒..)

先说登录 下面代码写在提现到微信的点击事件中
#pragma mark - WeChat提现需登录获取openID
- (void)loginViewClickedWechatButton
{
   UMSocialSnsPlatform *snsPlatform = [UMSocialSnsPlatformManager getSocialPlatformWithName:UMShareToWechatSession];

   snsPlatform.loginClickHandler(self,[UMSocialControllerService defaultControllerService],YES,^(UMSocialResponseEntity *response){
   //获取用户名、uid、token等
  if (response.responseCode == UMSResponseCodeSuccess) {
  UMSocialAccountEntity *snsAccount = [[UMSocialAccountManager socialAccountDictionary]valueForKey:UMShareToWechatSession];
    NSLog(@"\n uid : %@",snsAccount.unionId);
    //self.WxId就是提现需要的
    self.WxId = snsAccount.unionId;  
        }
   });
}
确认登录之后回到App
#pragma mark - 提现到微信
- (void)withdrawalToWeChat
{
  UIAlertController *alertC = [UIAlertController alertControllerWithTitle:@"提现到微信:" message:nil preferredStyle:UIAlertControllerStyleAlert];

  [alertC addTextFieldWithConfigurationHandler:^(UITextField * _Nonnull textField) {
    
    textField.keyboardType = UIKeyboardTypeDecimalPad;
    
    textField.placeholder = @"请输入提现金额";
  }];

  [alertC addAction:[UIAlertAction actionWithTitle:@"取消" style:UIAlertActionStyleCancel handler:nil]];
  [alertC addAction:[UIAlertAction actionWithTitle:@"确定" style:UIAlertActionStyleDestructive handler:^(UIAlertAction * _Nonnull action) {
    
    UITextField *textF = alertC.textFields[0];  //金额
    //然后在这里写后台给的提现到微信钱包的接口,把ID和钱数传过去
     [self requestDataWxId:self.WxId Money:money];
  }]];

    [self presentViewController:alertC animated:YES completion:nil];
}

2.支付宝提现

支付宝提现就简单多了 给后台传提现账号和钱数就OK

前提是要有一个给力的后台啊!!!说多了都是泪

你可能感兴趣的:(关于微信和支付宝提现的问题)